setup.py
changeset 7721 a1138f437640
parent 7720 b6c2cb40e664
child 7722 103127a8cbdb
--- a/setup.py	Wed Jan 28 10:32:15 2009 +0100
+++ b/setup.py	Thu Jan 29 19:25:25 2009 +0100
@@ -96,7 +96,14 @@
     pass
 
 try:
-    l = os.popen('hg id -it').read().split()
+    # execute hg out of this directory with a custom environment which
+    # includes the pure Python modules in mercurial/pure
+    pypath = os.environ.get('PYTHONPATH', '')
+    purepath = os.path.join('mercurial', 'pure')
+    os.environ['PYTHONPATH'] = os.pathsep.join(['mercurial', purepath, pypath])
+    cmd = '%s id -it' % os.path.join('.', 'hg')
+    l = os.popen(cmd).read().split()
+    os.environ['PYTHONPATH'] = pypath
     while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
         l.pop()
     version = l and l[-1] or 'unknown' # latest tag or revision number