Show More
@@ -4084,7 +4084,18 class TestRunner: | |||||
4084 |
|
|
4084 | # We cannot expect anything sensible here. | |
4085 |
|
|
4085 | return | |
4086 |
|
|
4086 | expecthg = os.path.join(self._pythondir, b'mercurial') | |
|
4087 | actual_bin_hg = self._get_hg_bin_path() | |||
4087 |
|
|
4088 | actual_py_hg = self._get_hg_py_path() | |
|
4089 | if actual_bin_hg != actual_py_hg: | |||
|
4090 | msg = ( | |||
|
4091 | b'fatal: "python" and "hg" disagree about mercurial lib path:\n' | |||
|
4092 | b' hg: %s:\n' | |||
|
4093 | b' py: %s:\n' | |||
|
4094 | ) | |||
|
4095 | msg %= (actual_bin_hg, actual_py_hg) | |||
|
4096 | msg = colorize(msg.decode(), "red", self.options.color) | |||
|
4097 | sys.stderr.write(msg) | |||
|
4098 | sys.exit(2) | |||
4088 |
|
|
4099 | if os.path.abspath(actual_py_hg) != os.path.abspath(expecthg): | |
4089 |
|
|
4100 | msg = ( | |
4090 |
|
|
4101 | 'warning: %s with unexpected mercurial lib: %s\n' | |
@@ -4130,6 +4141,29 class TestRunner: | |||||
4130 |
|
|
4141 | sys.exit(4) | |
4131 |
|
|
4142 | return out | |
4132 |
|
4143 | |||
|
4144 | def _get_hg_bin_path(self): | |||
|
4145 | """return the path to the mercurial lib according to the "hg" binary""" | |||
|
4146 | cmd = [ | |||
|
4147 | self._real_hg, | |||
|
4148 | "debuginstall", | |||
|
4149 | "--template", | |||
|
4150 | "{hgmodules}", | |||
|
4151 | ] | |||
|
4152 | p = subprocess.Popen( | |||
|
4153 | cmd, | |||
|
4154 | stdout=subprocess.PIPE, | |||
|
4155 | stderr=subprocess.PIPE, | |||
|
4156 | ) | |||
|
4157 | out, err = p.communicate() | |||
|
4158 | if p.returncode != 0: | |||
|
4159 | msg = "fatal: fetching library from `hg` failed:\n" | |||
|
4160 | msg = colorize(msg, "red", self.options.color) | |||
|
4161 | sys.stderr.write(msg) | |||
|
4162 | cmd_err = colorize(err.decode(), "yellow", self.options.color) | |||
|
4163 | sys.stderr.write(cmd_err) | |||
|
4164 | sys.exit(4) | |||
|
4165 | return out | |||
|
4166 | ||||
4133 |
|
|
4167 | def _get_hg_py_path(self): | |
4134 |
|
|
4168 | """Return the path to the mercurial package that is actually found by | |
4135 | the current Python interpreter.""" |
|
4169 | the current Python interpreter.""" |
General Comments 0
You need to be logged in to leave comments.
Login now