##// END OF EJS Templates
setup: handle more invalid python3 syntax...
Augie Fackler -
r20696:77ab0abb default
parent child Browse files
Show More
@@ -13,11 +13,18 b' if sys.version_info[0] >= 3:'
13 13 '''A helper function to emulate 2.6+ bytes literals using string
14 14 literals.'''
15 15 return s.encode('latin1')
16 printf = eval('print')
17 libdir_escape = 'unicode_escape'
16 18 else:
19 libdir_escape = 'string_escape'
17 20 def b(s):
18 21 '''A helper function to emulate 2.6+ bytes literals using string
19 22 literals.'''
20 23 return s
24 def printf(*args, **kwargs):
25 f = kwargs.get('file', sys.stdout)
26 end = kwargs.get('end', '\n')
27 f.write(b' '.join(args) + end)
21 28
22 29 # Solaris Python packaging brain damage
23 30 try:
@@ -151,8 +158,8 b' def runhg(cmd, env):'
151 158 and not e.startswith(b('warning: Not importing')) \
152 159 and not e.startswith(b('obsolete feature not enabled'))]
153 160 if err:
154 print >> sys.stderr, "stderr from '%s':" % (' '.join(cmd))
155 print >> sys.stderr, '\n'.join([' ' + e for e in err])
161 printf("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr)
162 printf(b('\n').join([b(' ') + e for e in err]), file=sys.stderr)
156 163 return ''
157 164 return out
158 165
@@ -402,7 +409,7 b' class hginstallscripts(install_scripts):'
402 409 if b('\0') in data:
403 410 continue
404 411
405 data = data.replace('@LIBDIR@', libdir.encode('string_escape'))
412 data = data.replace(b('@LIBDIR@'), libdir.encode(libdir_escape))
406 413 fp = open(outfile, 'wb')
407 414 fp.write(data)
408 415 fp.close()
General Comments 0
You need to be logged in to leave comments. Login now