
import invoke

# Based on https://github.com/pyca/cryptography/blob/master/tasks.py


@invoke.task
def changelog(version):
    print "Version %s" % version
    print "============="
    invoke.run('git log $(git describe --tags --abbrev=0)..HEAD --format=" - %s"')

@invoke.task
def release(version):
    invoke.run("git tag -a pyuv-{0} -m \"pyuv {0} release\"".format(version))
    invoke.run("git push --tags")

@invoke.task
def upload(version):
    invoke.run("python setup.py sdist")
    invoke.run("twine upload -r pypi dist/pyuv-{0}*".format(version))


@@ -13,293 +13,956 @@
 ke%0A%0A
-# Based on https://github.com/pyca/cryptography/blob/master/tasks.py%0A%0A%0A@invoke.task%0Adef changelog(version):%0A    print %22Version %25s%22 %25 version%0A    print %22=============%22%0A    invoke.run('git log $(git describe --tags --abbrev=0)..HEAD --format=%22 - %25s%22')%0A%0A@invoke.task%0Adef release(version):
+import datetime%0Aimport re%0Aimport subprocess%0A%0A%0Acmd = 'git log $(git describe --tags --abbrev=0)..HEAD --format=%22 - %25s%22 %7C tac'%0Achangelog_template = 'Version %25s%5Cn=============%5Cn%5Cn%25s%5Cn'%0Atag_template = '%25s - pyuv version %25s%5Cn%5Cn%25s%5Cn'%0A%0A%0Adef get_version():%0A    return re.search(r%22%22%22__version__%5Cs+=%5Cs+(?P%3Cquote%3E%5B'%22%5D)(?P%3Cversion%3E.+?)(?P=quote)%22%22%22, open('pyuv/_version.py').read()).group('version')%0A%0A@invoke.task%0Adef changelog():%0A    version = get_version()%0A    changelog = subprocess.check_output(cmd, shell=True)%0A    print changelog_template %25 (version, changelog)%0A%0A@invoke.task%0Adef release():%0A    version = get_version()%0A%0A    changelog = subprocess.check_output(cmd, shell=True)%0A    with open('ChangeLog', 'r+') as f:%0A        content = f.read()%0A        f.seek(0)%0A        f.write(changelog_template %25 (version, changelog))%0A        f.write(content)%0A%0A    dt = datetime.datetime.utcnow().replace(microsecond=0)%0A    tag = tag_template %25 (dt, version, changelog)
 %0A   
@@ -1003,24 +1003,11 @@
 m %5C%22
-pyuv %7B0%7D release
+%7B1%7D
 %5C%22%22.
@@ -1020,17 +1020,75 @@
 (version
-)
+, tag))%0A%0A@invoke.task%0Adef push():%0A    invoke.run(%22git push%22
 )%0A    in
@@ -1144,17 +1144,38 @@
 oad(
-version):
+):%0A    version = get_version()
 %0A   

enhance release process