aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2012-12-05 11:30:06 -0500
committerWaylan Limberg <waylan@gmail.com>2012-12-05 11:30:06 -0500
commite57b954a1f964ec0635d189c16d130c4e6ba5479 (patch)
tree190f20ecd936b71adce88781f65624ebcd0e2d32
parente9fe9c3516d434d3e10a55ad30399a2f42c6363a (diff)
downloadmarkdown-e57b954a1f964ec0635d189c16d130c4e6ba5479.tar.gz
markdown-e57b954a1f964ec0635d189c16d130c4e6ba5479.tar.bz2
markdown-e57b954a1f964ec0635d189c16d130c4e6ba5479.zip
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
-rw-r--r--fabfile.py2
-rw-r--r--markdown/__init__.py4
-rw-r--r--markdown/__version__.py28
-rwxr-xr-xsetup.py18
4 files changed, 46 insertions, 6 deletions
diff --git a/fabfile.py b/fabfile.py
index ea5ba06..16ceb1d 100644
--- a/fabfile.py
+++ b/fabfile.py
@@ -95,7 +95,7 @@ def build_envs():
def build_release():
""" Build a package for distribution. """
- ans = prompt('Have you updated the version in both setup.py and __init__.py?', default='Y')
+ ans = prompt('Have you updated the version_info in __version__.py?', default='Y')
if ans.lower() == 'y':
local('./setup.py sdist --formats zip,gztar')
if platform == 'win32':
diff --git a/markdown/__init__.py b/markdown/__init__.py
index 361aca2..959f387 100644
--- a/markdown/__init__.py
+++ b/markdown/__init__.py
@@ -30,9 +30,7 @@ Copyright 2004 Manfred Stienstra (the original version)
License: BSD (see LICENSE for details).
"""
-version = "2.2.1"
-version_info = (2,2,1, "final")
-
+from __version__ import version, version_info
import re
import codecs
import sys
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()
diff --git a/setup.py b/setup.py
index c501e0a..d8221be 100755
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,21 @@ except ImportError:
raise ImportError("build_py_2to3 is required to build in Python 3.x.")
from distutils.command.build_py import build_py
-version = '2.2.1'
+# Get version & version_info without importing markdown
+execfile(os.path.join(os.path.dirname(os.path.abspath(__file__)),
+ 'markdown/__version__.py'))
+
+# Get development Status for classifiers
+dev_status_map = {
+ 'alpha': '3 - Alpha',
+ 'beta' : '4 - Beta',
+ 'rc' : '4 - Beta',
+ 'final': '5 - Production/Stable'
+}
+if version_info[3] == 'alpha' and version_info[4] == 0:
+ DEVSTATUS = '2 - Pre-Alpha'
+else:
+ DEVSTATUS = dev_status_map[version_info[3]]
# The command line script name. Currently set to "markdown_py" so as not to
# conflict with the perl implimentation (which uses "markdown"). We can't use
@@ -204,7 +218,7 @@ data = dict(
'build_py': build_py,
'build_docs': build_docs,
'build': md_build},
- classifiers = ['Development Status :: 5 - Production/Stable',
+ classifiers = ['Development Status :: %s' % DEVSTATUS,
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',