Mercurial > hgsubversion
comparison setup.py @ 797:7bf283d4c7a9
Fixup Installing in Win32
author | Yonggang Luo <luoyonggang@gmail.com> |
---|---|
date | Fri, 15 Apr 2011 00:32:04 +0800 |
parents | 050f03a3bdf5 |
children | 3bffdf0e5948 |
comparison
equal
deleted
inserted
replaced
796:22f0c50c29a6 | 797:7bf283d4c7a9 |
---|---|
31 return '' | 31 return '' |
32 return out | 32 return out |
33 | 33 |
34 | 34 |
35 version = '' | 35 version = '' |
36 HG_COMMAND = 'hg' | |
37 if os.name == 'nt': | |
38 HG_COMMAND = 'hg.bat' | |
36 | 39 |
37 if os.path.isdir('.hg'): | 40 if os.path.isdir('.hg'): |
38 # Execute hg out of this directory with a custom environment which | 41 # Execute hg out of this directory with a custom environment which |
39 # includes the pure Python modules in mercurial/pure. We also take | 42 # includes the pure Python modules in mercurial/pure. We also take |
40 # care to not use any hgrc files and do no localization. | 43 # care to not use any hgrc files and do no localization. |
46 if 'SystemRoot' in os.environ: | 49 if 'SystemRoot' in os.environ: |
47 # Copy SystemRoot into the custom environment for Python 2.6 | 50 # Copy SystemRoot into the custom environment for Python 2.6 |
48 # under Windows. Otherwise, the subprocess will fail with | 51 # under Windows. Otherwise, the subprocess will fail with |
49 # error 0xc0150004. See: http://bugs.python.org/issue3440 | 52 # error 0xc0150004. See: http://bugs.python.org/issue3440 |
50 env['SystemRoot'] = os.environ['SystemRoot'] | 53 env['SystemRoot'] = os.environ['SystemRoot'] |
51 cmd = ['hg', 'id', '-i', '-t'] | 54 cmd = [HG_COMMAND, 'id', '-i', '-t'] |
52 l = runcmd(cmd, env).split() | 55 l = runcmd(cmd, env).split() |
53 while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags | 56 while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags |
54 l.pop() | 57 l.pop() |
55 if len(l) > 1: # tag found | 58 if len(l) > 1: # tag found |
56 version = l[-1] | 59 version = l[-1] |
57 if l[0].endswith('+'): # propagate the dirty status to the tag | 60 if l[0].endswith('+'): # propagate the dirty status to the tag |
58 version += '+' | 61 version += '+' |
59 elif len(l) == 1: # no tag found | 62 elif len(l) == 1: # no tag found |
60 cmd = ['hg', 'parents', '--template', | 63 cmd = [HG_COMMAND, 'parents', '--template', |
61 '{latesttag}+{latesttagdistance}-'] | 64 '{latesttag}+{latesttagdistance}-'] |
62 version = runcmd(cmd, env) + l[0] | 65 version = runcmd(cmd, env) + l[0] |
63 if not version: | 66 if not version: |
64 version = runcmd(['hg', 'parents', '--template' '{node|short}\n'], | 67 version = runcmd([HG_COMMAND, 'parents', '--template' '{node|short}\n'], |
65 env) | 68 env) |
66 if version: | 69 if version: |
67 version = version.split()[0] | 70 version = version.split()[0] |
68 if version.endswith('+'): | 71 if version.endswith('+'): |
69 version += time.strftime('%Y%m%d') | 72 version += time.strftime('%Y%m%d') |