summaryrefslogtreecommitdiff
path: root/release.py
diff options
context:
space:
mode:
Diffstat (limited to 'release.py')
-rw-r--r--release.py69
1 files changed, 45 insertions, 24 deletions
diff --git a/release.py b/release.py
index 5b691c4c..bd944647 100644
--- a/release.py
+++ b/release.py
@@ -22,19 +22,37 @@ try:
except Exception:
pass
-VERSION = '0.6.45'
-PACKAGE_INDEX = 'https://pypi.python.org/pypi'
+VERSION = '0.7b4'
PACKAGE_INDEX = 'https://pypi.python.org/pypi'
-def get_next_version():
- digits = map(int, VERSION.split('.'))
- digits[-1] += 1
- return '.'.join(map(str, digits))
+def get_next_version(version):
+ """
+ Infer a next version from the current version by incrementing the last
+ number or appending a number.
+
+ >>> get_next_version('1.0')
+ '1.1'
+
+ >>> get_next_version('1.0b')
+ '1.0b1'
+
+ >>> get_next_version('1.0.9')
+ '1.0.10'
-NEXT_VERSION = get_next_version()
+ >>> get_next_version('1')
+ '2'
-files_with_versions = ('docs/conf.py', 'setup.py', 'release.py',
- 'README.txt', 'distribute_setup.py')
+ >>> get_next_version('')
+ '1'
+ """
+ def incr(match):
+ ver = int(match.group(0) or '0')
+ return str(ver + 1)
+ return re.sub('\d*$', incr, version)
+
+NEXT_VERSION = get_next_version(VERSION)
+
+files_with_versions = 'docs/conf.py', 'setup.py', 'release.py', 'ez_setup.py'
def get_repo_name():
"""
@@ -114,21 +132,7 @@ def do_release():
subprocess.check_call(['hg', 'update', VERSION])
- linkify('CHANGES.txt', 'CHANGES (links).txt')
-
- has_docs = build_docs()
- if os.path.isdir('./dist'):
- shutil.rmtree('./dist')
- cmd = [
- sys.executable, 'setup.py', '-q',
- 'egg_info', '-RD', '-b', '',
- 'sdist',
- 'register', '-r', PACKAGE_INDEX,
- 'upload', '-r', PACKAGE_INDEX,
- ]
- if has_docs:
- cmd.extend(['upload_docs', '-r', PACKAGE_INDEX])
- subprocess.check_call(cmd)
+ upload_to_pypi()
upload_bootstrap_script()
# update to the tip for the next operation
@@ -145,6 +149,23 @@ def do_release():
add_milestone_and_version()
+def upload_to_pypi():
+ linkify('CHANGES.txt', 'CHANGES (links).txt')
+
+ has_docs = build_docs()
+ if os.path.isdir('./dist'):
+ shutil.rmtree('./dist')
+ cmd = [
+ sys.executable, 'setup.py', '-q',
+ 'egg_info', '-RD', '-b', '',
+ 'sdist',
+ 'register', '-r', PACKAGE_INDEX,
+ 'upload', '-r', PACKAGE_INDEX,
+ ]
+ if has_docs:
+ cmd.extend(['upload_docs', '-r', PACKAGE_INDEX])
+ subprocess.check_call(cmd)
+
def has_sphinx():
try:
devnull = open(os.path.devnull, 'wb')