aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2012-12-18 14:57:07 -0500
committerWaylan Limberg <waylan@gmail.com>2012-12-18 14:57:07 -0500
commitd6a747570a053f15dc4951689b7820248f2cc25f (patch)
tree850b64deb85eb5b8d7d72a13fa945c95eb926f45 /setup.py
parent9bcd7b8763627c64184b0bf147ec1830fde0a5dc (diff)
downloadmarkdown-d6a747570a053f15dc4951689b7820248f2cc25f.tar.gz
markdown-d6a747570a053f15dc4951689b7820248f2cc25f.tar.bz2
markdown-d6a747570a053f15dc4951689b7820248f2cc25f.zip
Fixed #169. The new version stuff now works in python 2 & 3.
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/setup.py b/setup.py
index d8221be..855a08d 100755
--- a/setup.py
+++ b/setup.py
@@ -8,6 +8,7 @@ from distutils.command.build import build
from distutils.core import Command
from distutils.util import change_root, newer
import codecs
+import imp
# Try to run 2to3 automaticaly when building in Python 3.x
try:
@@ -17,9 +18,17 @@ except ImportError:
raise ImportError("build_py_2to3 is required to build in Python 3.x.")
from distutils.command.build_py import build_py
-# Get version & version_info without importing markdown
-execfile(os.path.join(os.path.dirname(os.path.abspath(__file__)),
- 'markdown/__version__.py'))
+def get_version():
+ " Get version & version_info without importing markdown.__init__ "
+ path = os.path.join(os.path.dirname(__file__), 'markdown')
+ fp, pathname, desc = imp.find_module('__version__', [path])
+ try:
+ v = imp.load_module('__version__', fp, pathname, desc)
+ return v.version, v.version_info
+ finally:
+ fp.close()
+
+version, version_info = get_version()
# Get development Status for classifiers
dev_status_map = {