Show More
@@ -121,6 +121,10 b' def runcmd(cmd, env):' | |||||
121 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
|
121 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE, | |
122 | stderr=subprocess.PIPE, env=env) |
|
122 | stderr=subprocess.PIPE, env=env) | |
123 | out, err = p.communicate() |
|
123 | out, err = p.communicate() | |
|
124 | return out, err | |||
|
125 | ||||
|
126 | def runhg(cmd, env): | |||
|
127 | out, err = runcmd(cmd, env) | |||
124 | # If root is executing setup.py, but the repository is owned by |
|
128 | # If root is executing setup.py, but the repository is owned by | |
125 | # another user (as in "sudo python setup.py install") we will get |
|
129 | # another user (as in "sudo python setup.py install") we will get | |
126 | # trust warnings since the .hg/hgrc file is untrusted. That is |
|
130 | # trust warnings since the .hg/hgrc file is untrusted. That is | |
@@ -151,7 +155,7 b" if os.path.isdir('.hg'):" | |||||
151 | # error 0xc0150004. See: http://bugs.python.org/issue3440 |
|
155 | # error 0xc0150004. See: http://bugs.python.org/issue3440 | |
152 | env['SystemRoot'] = os.environ['SystemRoot'] |
|
156 | env['SystemRoot'] = os.environ['SystemRoot'] | |
153 | cmd = [sys.executable, 'hg', 'id', '-i', '-t'] |
|
157 | cmd = [sys.executable, 'hg', 'id', '-i', '-t'] | |
154 |
l = run |
|
158 | l = runhg(cmd, env).split() | |
155 | while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags |
|
159 | while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags | |
156 | l.pop() |
|
160 | l.pop() | |
157 | if len(l) > 1: # tag found |
|
161 | if len(l) > 1: # tag found | |
@@ -161,7 +165,7 b" if os.path.isdir('.hg'):" | |||||
161 | elif len(l) == 1: # no tag found |
|
165 | elif len(l) == 1: # no tag found | |
162 | cmd = [sys.executable, 'hg', 'parents', '--template', |
|
166 | cmd = [sys.executable, 'hg', 'parents', '--template', | |
163 | '{latesttag}+{latesttagdistance}-'] |
|
167 | '{latesttag}+{latesttagdistance}-'] | |
164 |
version = run |
|
168 | version = runhg(cmd, env) + l[0] | |
165 | if version.endswith('+'): |
|
169 | if version.endswith('+'): | |
166 | version += time.strftime('%Y%m%d') |
|
170 | version += time.strftime('%Y%m%d') | |
167 | elif os.path.exists('.hg_archival.txt'): |
|
171 | elif os.path.exists('.hg_archival.txt'): | |
@@ -377,7 +381,7 b" if os.name == 'nt':" | |||||
377 | if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'): |
|
381 | if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'): | |
378 | # XCode 4.0 dropped support for ppc architecture, which is hardcoded in |
|
382 | # XCode 4.0 dropped support for ppc architecture, which is hardcoded in | |
379 | # distutils.sysconfig |
|
383 | # distutils.sysconfig | |
380 | version = runcmd(['/usr/bin/xcodebuild', '-version'], {}).splitlines()[0] |
|
384 | version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()[0] | |
381 | # Also parse only first digit, because 3.2.1 can't be parsed nicely |
|
385 | # Also parse only first digit, because 3.2.1 can't be parsed nicely | |
382 | if (version.startswith('Xcode') and |
|
386 | if (version.startswith('Xcode') and | |
383 | StrictVersion(version.split()[1]) >= StrictVersion('4.0')): |
|
387 | StrictVersion(version.split()[1]) >= StrictVersion('4.0')): |
General Comments 0
You need to be logged in to leave comments.
Login now