mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-12-07 10:28:30 +00:00
Python 2.6 support for generate_headers.py.
This commit is contained in:
parent
4c2cec50b1
commit
eec5601a7f
@ -13,9 +13,20 @@ OutputFolder = os.path.normpath(argv[1])
|
|||||||
|
|
||||||
def get_hg_version():
|
def get_hg_version():
|
||||||
argv = ['hg', 'parent', '-R', SourceFolder]
|
argv = ['hg', 'parent', '-R', SourceFolder]
|
||||||
|
|
||||||
|
# Python 2.6 doesn't have check_output.
|
||||||
|
if hasattr(subprocess, 'check_output'):
|
||||||
text = subprocess.check_output(argv)
|
text = subprocess.check_output(argv)
|
||||||
if str != bytes:
|
if str != bytes:
|
||||||
text = str(text, 'utf-8')
|
text = str(text, 'utf-8')
|
||||||
|
else:
|
||||||
|
p = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
output, ignored = p.communicate()
|
||||||
|
rval = p.poll()
|
||||||
|
if rval:
|
||||||
|
raise subprocess.CalledProcessError(rval, argv)
|
||||||
|
text = output.decode('utf8')
|
||||||
|
|
||||||
m = re.match('changeset:\s+(\d+):(.+)', text)
|
m = re.match('changeset:\s+(\d+):(.+)', text)
|
||||||
if m == None:
|
if m == None:
|
||||||
raise Exception('Could not determine repository version')
|
raise Exception('Could not determine repository version')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user