Mercurial > hgsubversion
changeset 797:7bf283d4c7a9
Fixup Installing in Win32
author | Yonggang Luo <luoyonggang@gmail.com> |
---|---|
date | Fri, 15 Apr 2011 00:32:04 +0800 |
parents | 22f0c50c29a6 |
children | 3bffdf0e5948 |
files | setup.py |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/setup.py +++ b/setup.py @@ -33,6 +33,9 @@ def runcmd(cmd, env): version = '' +HG_COMMAND = 'hg' +if os.name == 'nt': + HG_COMMAND = 'hg.bat' if os.path.isdir('.hg'): # Execute hg out of this directory with a custom environment which @@ -48,7 +51,7 @@ if os.path.isdir('.hg'): # under Windows. Otherwise, the subprocess will fail with # error 0xc0150004. See: http://bugs.python.org/issue3440 env['SystemRoot'] = os.environ['SystemRoot'] - cmd = ['hg', 'id', '-i', '-t'] + cmd = [HG_COMMAND, 'id', '-i', '-t'] l = runcmd(cmd, env).split() while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags l.pop() @@ -57,11 +60,11 @@ if os.path.isdir('.hg'): if l[0].endswith('+'): # propagate the dirty status to the tag version += '+' elif len(l) == 1: # no tag found - cmd = ['hg', 'parents', '--template', + cmd = [HG_COMMAND, 'parents', '--template', '{latesttag}+{latesttagdistance}-'] version = runcmd(cmd, env) + l[0] if not version: - version = runcmd(['hg', 'parents', '--template' '{node|short}\n'], + version = runcmd([HG_COMMAND, 'parents', '--template' '{node|short}\n'], env) if version: version = version.split()[0]