From d6a747570a053f15dc4951689b7820248f2cc25f Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Tue, 18 Dec 2012 14:57:07 -0500 Subject: Fixed #169. The new version stuff now works in python 2 & 3. --- setup.py | 15 ++++++++++++--- 1 file 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 = { -- cgit v1.2.3