setup: use sys.executable to call hg
authorMartin Geisler <mg@daimi.au.dk>
Wed, 18 Feb 2009 00:44:38 +0100
changeset 7790 1817e45c2212
parent 7789 e8d62d6133c2
child 7791 089cb73f8ecc
setup: use sys.executable to call hg Executing ".\hg" does not work on Windows, but we can instead ask Python to execute hg.
setup.py
--- a/setup.py	Tue Feb 17 23:58:56 2009 +0100
+++ b/setup.py	Wed Feb 18 00:44:38 2009 +0100
@@ -103,7 +103,7 @@
     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')
+    cmd = '%s hg id -it' % sys.executable
     l = os.popen(cmd).read().split()
     os.environ['PYTHONPATH'] = pypath
     while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
@@ -112,7 +112,8 @@
     if version.endswith('+'):
         version += time.strftime('%Y%m%d')
 
-except OSError:
+except OSError, e:
+    print "warning: could not establish Mercurial version: %s" % e
     version = "unknown"
 
 f = file("mercurial/__version__.py", "w")