Show More
@@ -9,22 +9,14 b" if getattr(sys, 'version_info', (0, 0, 0" | |||
|
9 | 9 | raise SystemExit("Mercurial requires Python 2.6 or later.") |
|
10 | 10 | |
|
11 | 11 | if sys.version_info[0] >= 3: |
|
12 | def b(s): | |
|
13 | '''A helper function to emulate 2.6+ bytes literals using string | |
|
14 | literals.''' | |
|
15 | return s.encode('latin1') | |
|
16 | 12 | printf = eval('print') |
|
17 | 13 | libdir_escape = 'unicode_escape' |
|
18 | 14 | else: |
|
19 | 15 | libdir_escape = 'string_escape' |
|
20 | def b(s): | |
|
21 | '''A helper function to emulate 2.6+ bytes literals using string | |
|
22 | literals.''' | |
|
23 | return s | |
|
24 | 16 | def printf(*args, **kwargs): |
|
25 | 17 | f = kwargs.get('file', sys.stdout) |
|
26 | 18 | end = kwargs.get('end', '\n') |
|
27 |
f.write(b |
|
|
19 | f.write(b' '.join(args) + end) | |
|
28 | 20 | |
|
29 | 21 | # Solaris Python packaging brain damage |
|
30 | 22 | try: |
@@ -172,12 +164,12 b' def runhg(cmd, env):' | |||
|
172 | 164 | # fine, we don't want to load it anyway. Python may warn about |
|
173 | 165 | # a missing __init__.py in mercurial/locale, we also ignore that. |
|
174 | 166 | err = [e for e in err.splitlines() |
|
175 |
if not e.startswith(b |
|
|
176 |
and not e.startswith(b |
|
|
177 |
and not e.startswith(b |
|
|
167 | if not e.startswith(b'not trusting file') \ | |
|
168 | and not e.startswith(b'warning: Not importing') \ | |
|
169 | and not e.startswith(b'obsolete feature not enabled')] | |
|
178 | 170 | if err: |
|
179 | 171 | printf("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr) |
|
180 |
printf(b |
|
|
172 | printf(b'\n'.join([b' ' + e for e in err]), file=sys.stderr) | |
|
181 | 173 | return '' |
|
182 | 174 | return out |
|
183 | 175 | |
@@ -516,7 +508,7 b' class hginstallscripts(install_scripts):' | |||
|
516 | 508 | fp.close() |
|
517 | 509 | |
|
518 | 510 | # skip binary files |
|
519 |
if b |
|
|
511 | if b'\0' in data: | |
|
520 | 512 | continue |
|
521 | 513 | |
|
522 | 514 | # During local installs, the shebang will be rewritten to the final |
@@ -527,7 +519,7 b' class hginstallscripts(install_scripts):' | |||
|
527 | 519 | 'not known' % outfile) |
|
528 | 520 | continue |
|
529 | 521 | |
|
530 |
data = data.replace(b |
|
|
522 | data = data.replace(b'@LIBDIR@', libdir.encode(libdir_escape)) | |
|
531 | 523 | fp = open(outfile, 'wb') |
|
532 | 524 | fp.write(data) |
|
533 | 525 | fp.close() |
General Comments 0
You need to be logged in to leave comments.
Login now