From e57b954a1f964ec0635d189c16d130c4e6ba5479 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Wed, 5 Dec 2012 11:30:06 -0500 Subject: Upped version to 2.3.dev. Also refactored the version info to force PEP 386 compliance and to avoid the need to change the version in both the source and setup.py --- markdown/__version__.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 markdown/__version__.py (limited to 'markdown/__version__.py') diff --git a/markdown/__version__.py b/markdown/__version__.py new file mode 100644 index 0000000..bbe1b3f --- /dev/null +++ b/markdown/__version__.py @@ -0,0 +1,28 @@ +# +# markdown/__version__.py +# +# version_info should conform to PEP 386 +# (major, minor, micro, alpha/beta/rc/final, #) +# (1, 1, 2, 'alpha', 0) => "1.1.2.dev" +# (1, 2, 0, 'beta', 2) => "1.2b2" +version_info = (2, 3, 0, 'alpha', 0) + +def _get_version(): + " Returns a PEP 386-compliant version number from version_info. " + assert len(version_info) == 5 + assert version_info[3] in ('alpha', 'beta', 'rc', 'final') + + parts = 2 if version_info[2] == 0 else 3 + main = '.'.join(map(str, version_info[:parts])) + + sub = '' + if version_info[3] == 'alpha' and version_info[4] == 0: + # TODO: maybe append some sort of git info here?? + sub = '.dev' + elif version_info[3] != 'final': + mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'} + sub = mapping[version_info[3]] + str(version_info[4]) + + return str(main + sub) + +version = _get_version() -- cgit v1.2.3