OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 # This Source Code Form is subject to the terms of the Mozilla Public | 2 # This Source Code Form is subject to the terms of the Mozilla Public |
3 # License, v. 2.0. If a copy of the MPL was not distributed with this | 3 # License, v. 2.0. If a copy of the MPL was not distributed with this |
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 4 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
5 | 5 |
6 # The beginning of this script is both valid shell and valid python, | 6 # The beginning of this script is both valid shell and valid python, |
7 # such that the script starts with the shell and is reexecuted with | 7 # such that the script starts with the shell and is reexecuted with |
8 # the right python. | 8 # the right python. |
9 '''which' python2.7 > /dev/null && exec python2.7 "$0" "$@" || exec python "$0"
"$@" | 9 '''which' python2.7 > /dev/null && exec python2.7 "$0" "$@" || exec python "$0"
"$@" |
10 ''' | 10 ''' |
11 | 11 |
12 from __future__ import print_function, unicode_literals | 12 from __future__ import print_function, unicode_literals |
13 | 13 |
14 import os | 14 import os |
15 import sys | 15 import sys |
16 | 16 |
| 17 # Disable mercurial-setup permanently. See https://issues.adblockplus.org/ticket
/5567 |
| 18 os.environ['I_PREFER_A_SUBOPTIMAL_MERCURIAL_EXPERIENCE'] = '1' |
| 19 |
17 def ancestors(path): | 20 def ancestors(path): |
18 while path: | 21 while path: |
19 yield path | 22 yield path |
20 (path, child) = os.path.split(path) | 23 (path, child) = os.path.split(path) |
21 if child == "": | 24 if child == "": |
22 break | 25 break |
23 | 26 |
24 def load_mach(dir_path, mach_path): | 27 def load_mach(dir_path, mach_path): |
25 import imp | 28 import imp |
26 with open(mach_path, 'r') as fh: | 29 with open(mach_path, 'r') as fh: |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 # Remove the first line (for 'def fork_interpose():') and the three | 142 # Remove the first line (for 'def fork_interpose():') and the three |
140 # levels of indentation (12 spaces). | 143 # levels of indentation (12 spaces). |
141 fork_string = ''.join(x[12:] for x in fork_code[1:]) | 144 fork_string = ''.join(x[12:] for x in fork_code[1:]) |
142 cmdline = orig_command_line() | 145 cmdline = orig_command_line() |
143 cmdline[2] = fork_string | 146 cmdline[2] = fork_string |
144 return cmdline | 147 return cmdline |
145 orig_command_line = forking.get_command_line | 148 orig_command_line = forking.get_command_line |
146 forking.get_command_line = my_get_command_line | 149 forking.get_command_line = my_get_command_line |
147 | 150 |
148 main(sys.argv[1:]) | 151 main(sys.argv[1:]) |
OLD | NEW |