Show More
@@ -13,11 +13,18 b' if sys.version_info[0] >= 3:' | |||||
13 | '''A helper function to emulate 2.6+ bytes literals using string |
|
13 | '''A helper function to emulate 2.6+ bytes literals using string | |
14 | literals.''' |
|
14 | literals.''' | |
15 | return s.encode('latin1') |
|
15 | return s.encode('latin1') | |
|
16 | printf = eval('print') | |||
|
17 | libdir_escape = 'unicode_escape' | |||
16 | else: |
|
18 | else: | |
|
19 | libdir_escape = 'string_escape' | |||
17 | def b(s): |
|
20 | def b(s): | |
18 | '''A helper function to emulate 2.6+ bytes literals using string |
|
21 | '''A helper function to emulate 2.6+ bytes literals using string | |
19 | literals.''' |
|
22 | literals.''' | |
20 | return s |
|
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 | # Solaris Python packaging brain damage |
|
29 | # Solaris Python packaging brain damage | |
23 | try: |
|
30 | try: | |
@@ -151,8 +158,8 b' def runhg(cmd, env):' | |||||
151 | and not e.startswith(b('warning: Not importing')) \ |
|
158 | and not e.startswith(b('warning: Not importing')) \ | |
152 | and not e.startswith(b('obsolete feature not enabled'))] |
|
159 | and not e.startswith(b('obsolete feature not enabled'))] | |
153 | if err: |
|
160 | if err: | |
154 |
print |
|
161 | printf("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr) | |
155 |
print |
|
162 | printf(b('\n').join([b(' ') + e for e in err]), file=sys.stderr) | |
156 | return '' |
|
163 | return '' | |
157 | return out |
|
164 | return out | |
158 |
|
165 | |||
@@ -402,7 +409,7 b' class hginstallscripts(install_scripts):' | |||||
402 | if b('\0') in data: |
|
409 | if b('\0') in data: | |
403 | continue |
|
410 | continue | |
404 |
|
411 | |||
405 |
data = data.replace('@LIBDIR@', libdir.encode( |
|
412 | data = data.replace(b('@LIBDIR@'), libdir.encode(libdir_escape)) | |
406 | fp = open(outfile, 'wb') |
|
413 | fp = open(outfile, 'wb') | |
407 | fp.write(data) |
|
414 | fp.write(data) | |
408 | fp.close() |
|
415 | fp.close() |
General Comments 0
You need to be logged in to leave comments.
Login now