##// END OF EJS Templates
setup: convert version strings to unicode on Python 3...
Yuya Nishihara -
r35246:d73ccc63 default
parent child Browse files
Show More
@@ -29,12 +29,16 import sys, platform
29 if sys.version_info[0] >= 3:
29 if sys.version_info[0] >= 3:
30 printf = eval('print')
30 printf = eval('print')
31 libdir_escape = 'unicode_escape'
31 libdir_escape = 'unicode_escape'
32 def sysstr(s):
33 return s.decode('latin-1')
32 else:
34 else:
33 libdir_escape = 'string_escape'
35 libdir_escape = 'string_escape'
34 def printf(*args, **kwargs):
36 def printf(*args, **kwargs):
35 f = kwargs.get('file', sys.stdout)
37 f = kwargs.get('file', sys.stdout)
36 end = kwargs.get('end', '\n')
38 end = kwargs.get('end', '\n')
37 f.write(b' '.join(args) + end)
39 f.write(b' '.join(args) + end)
40 def sysstr(s):
41 return s
38
42
39 # Attempt to guide users to a modern pip - this means that 2.6 users
43 # Attempt to guide users to a modern pip - this means that 2.6 users
40 # should have a chance of getting a 4.2 release, and when we ratchet
44 # should have a chance of getting a 4.2 release, and when we ratchet
@@ -295,8 +299,8 version = ''
295 if os.path.isdir('.hg'):
299 if os.path.isdir('.hg'):
296 hg = findhg()
300 hg = findhg()
297 cmd = ['log', '-r', '.', '--template', '{tags}\n']
301 cmd = ['log', '-r', '.', '--template', '{tags}\n']
298 numerictags = [t for t in hg.run(cmd).split() if t[0:1].isdigit()]
302 numerictags = [t for t in sysstr(hg.run(cmd)).split() if t[0:1].isdigit()]
299 hgid = hg.run(['id', '-i']).strip()
303 hgid = sysstr(hg.run(['id', '-i'])).strip()
300 if not hgid:
304 if not hgid:
301 # Bail out if hg is having problems interacting with this repository,
305 # Bail out if hg is having problems interacting with this repository,
302 # rather than falling through and producing a bogus version number.
306 # rather than falling through and producing a bogus version number.
@@ -309,7 +313,7 if os.path.isdir('.hg'):
309 version += '+'
313 version += '+'
310 else: # no tag found
314 else: # no tag found
311 ltagcmd = ['parents', '--template', '{latesttag}']
315 ltagcmd = ['parents', '--template', '{latesttag}']
312 ltag = hg.run(ltagcmd)
316 ltag = sysstr(hg.run(ltagcmd))
313 changessincecmd = ['log', '-T', 'x\n', '-r', "only(.,'%s')" % ltag]
317 changessincecmd = ['log', '-T', 'x\n', '-r', "only(.,'%s')" % ltag]
314 changessince = len(hg.run(changessincecmd).splitlines())
318 changessince = len(hg.run(changessincecmd).splitlines())
315 version = '%s+%s-%s' % (ltag, changessince, hgid)
319 version = '%s+%s-%s' % (ltag, changessince, hgid)
General Comments 0
You need to be logged in to leave comments. Login now