Commit 0465490e authored by Jason R. Coombs's avatar Jason R. Coombs

Updated get_next_version to bump arbitrary versions and added doctests.

parent f1427c0e
......@@ -25,12 +25,32 @@ except Exception:
VERSION = '0.7b1'
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'
>>> get_next_version('1')
'2'
>>> 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()
NEXT_VERSION = get_next_version(VERSION)
files_with_versions = 'docs/conf.py', 'setup.py', 'release.py', 'ez_setup.py'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment