Mercurial > hgsubversion
comparison setup.py @ 798:3bffdf0e5948
Backed out changeset 7bf283d4c7a9 in favor of a better win32 fix
In the future I'll try to get commentary from Windows people *before*
pushing a patch.
| author | Augie Fackler <durin42@gmail.com> |
|---|---|
| date | Sun, 17 Apr 2011 20:28:04 -0500 |
| parents | 7bf283d4c7a9 |
| children | 0b56b1492d23 |
comparison
equal
deleted
inserted
replaced
| 797:7bf283d4c7a9 | 798:3bffdf0e5948 |
|---|---|
| 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' | |
| 39 | 36 |
| 40 if os.path.isdir('.hg'): | 37 if os.path.isdir('.hg'): |
| 41 # Execute hg out of this directory with a custom environment which | 38 # Execute hg out of this directory with a custom environment which |
| 42 # includes the pure Python modules in mercurial/pure. We also take | 39 # includes the pure Python modules in mercurial/pure. We also take |
| 43 # care to not use any hgrc files and do no localization. | 40 # care to not use any hgrc files and do no localization. |
| 49 if 'SystemRoot' in os.environ: | 46 if 'SystemRoot' in os.environ: |
| 50 # Copy SystemRoot into the custom environment for Python 2.6 | 47 # Copy SystemRoot into the custom environment for Python 2.6 |
| 51 # under Windows. Otherwise, the subprocess will fail with | 48 # under Windows. Otherwise, the subprocess will fail with |
| 52 # error 0xc0150004. See: http://bugs.python.org/issue3440 | 49 # error 0xc0150004. See: http://bugs.python.org/issue3440 |
| 53 env['SystemRoot'] = os.environ['SystemRoot'] | 50 env['SystemRoot'] = os.environ['SystemRoot'] |
| 54 cmd = [HG_COMMAND, 'id', '-i', '-t'] | 51 cmd = ['hg', 'id', '-i', '-t'] |
| 55 l = runcmd(cmd, env).split() | 52 l = runcmd(cmd, env).split() |
| 56 while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags | 53 while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags |
| 57 l.pop() | 54 l.pop() |
| 58 if len(l) > 1: # tag found | 55 if len(l) > 1: # tag found |
| 59 version = l[-1] | 56 version = l[-1] |
| 60 if l[0].endswith('+'): # propagate the dirty status to the tag | 57 if l[0].endswith('+'): # propagate the dirty status to the tag |
| 61 version += '+' | 58 version += '+' |
| 62 elif len(l) == 1: # no tag found | 59 elif len(l) == 1: # no tag found |
| 63 cmd = [HG_COMMAND, 'parents', '--template', | 60 cmd = ['hg', 'parents', '--template', |
| 64 '{latesttag}+{latesttagdistance}-'] | 61 '{latesttag}+{latesttagdistance}-'] |
| 65 version = runcmd(cmd, env) + l[0] | 62 version = runcmd(cmd, env) + l[0] |
| 66 if not version: | 63 if not version: |
| 67 version = runcmd([HG_COMMAND, 'parents', '--template' '{node|short}\n'], | 64 version = runcmd(['hg', 'parents', '--template' '{node|short}\n'], |
| 68 env) | 65 env) |
| 69 if version: | 66 if version: |
| 70 version = version.split()[0] | 67 version = version.split()[0] |
| 71 if version.endswith('+'): | 68 if version.endswith('+'): |
| 72 version += time.strftime('%Y%m%d') | 69 version += time.strftime('%Y%m%d') |
