setup.py
branchstable
changeset 1149 a206ee74f129
parent 1138 c13b408c0006
child 1242 cf846d47bb7e
--- a/setup.py	Mon Nov 03 10:25:20 2014 +0000
+++ b/setup.py	Mon Oct 20 13:54:46 2014 +0300
@@ -2,10 +2,21 @@
 # Credit to Augie Fackler <durin42@gmail.com>
 
 from distutils.core import setup
+from os.path import dirname, join
+
+def get_version(relpath):
+    '''Read version info from a file without importing it'''
+    for line in open(join(dirname(__file__), relpath), 'rb'):
+        # Decode to a fail-safe string for PY3
+        # (gives unicode object in PY2)
+        line = line.decode('utf8')
+        if '__version__' in line:
+          if "'" in line:
+            return line.split("'")[1]
 
 setup(
     name='hg-evolve',
-    version='5.0.0',
+    version=get_version('hgext/evolve.py'),
     author='Pierre-Yves David',
     maintainer='Pierre-Yves David',
     maintainer_email='pierre-yves.david@ens-lyon.org',