diff options
Diffstat (limited to 'release.py')
| -rw-r--r-- | release.py | 35 |
1 files changed, 26 insertions, 9 deletions
@@ -9,11 +9,17 @@ import subprocess import pkg_resources -pkg_resources.require('jaraco.packaging>=1.1') +pkg_resources.require('jaraco.packaging>=2.0') + def before_upload(): _linkify('CHANGES.txt', 'CHANGES (links).txt') - _add_bootstrap_bookmark() + BootstrapBookmark.add() + + +def after_push(): + os.remove('CHANGES (links).txt') + BootstrapBookmark.push() files_with_versions = ( 'ez_setup.py', 'setuptools/version.py', @@ -23,9 +29,6 @@ test_info = "Travis-CI tests: http://travis-ci.org/#!/jaraco/setuptools" os.environ["SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES"] = "1" -# override the push command to include the bootstrap bookmark. -push_command = ['hg', 'push', '-B', 'bootstrap'] - link_patterns = [ r"(Issue )?#(?P<issue>\d+)", r"Distribute #(?P<distribute>\d+)", @@ -61,7 +64,21 @@ def replacer(match): url = issue_urls[key].format(**match_dict) return "`{text} <{url}>`_".format(text=text, url=url) - -def _add_bootstrap_bookmark(): - cmd = ['hg', 'bookmark', '-i', 'bootstrap', '-f'] - subprocess.Popen(cmd) +class BootstrapBookmark: + name = 'bootstrap' + + @classmethod + def add(cls): + cmd = ['hg', 'bookmark', '-i', cls.name, '-f'] + subprocess.Popen(cmd) + + @classmethod + def push(cls): + """ + Push the bootstrap bookmark + """ + push_command = ['hg', 'push', '-B', cls.name] + # don't use check_call here because mercurial will return a non-zero + # code even if it succeeds at pushing the bookmark (because there are + # no changesets to be pushed). !dm mercurial + subprocess.call(push_command) |
