##// END OF EJS Templates
run-test: check that the "hg" binary and "python" agree on mercurial path...
marmoute -
r53413:20690cff default
parent child Browse files
Show More
@@ -4084,7 +4084,18 class TestRunner:
4084 # We cannot expect anything sensible here.
4084 # We cannot expect anything sensible here.
4085 return
4085 return
4086 expecthg = os.path.join(self._pythondir, b'mercurial')
4086 expecthg = os.path.join(self._pythondir, b'mercurial')
4087 actual_bin_hg = self._get_hg_bin_path()
4087 actual_py_hg = self._get_hg_py_path()
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 if os.path.abspath(actual_py_hg) != os.path.abspath(expecthg):
4099 if os.path.abspath(actual_py_hg) != os.path.abspath(expecthg):
4089 msg = (
4100 msg = (
4090 'warning: %s with unexpected mercurial lib: %s\n'
4101 'warning: %s with unexpected mercurial lib: %s\n'
@@ -4130,6 +4141,29 class TestRunner:
4130 sys.exit(4)
4141 sys.exit(4)
4131 return out
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 def _get_hg_py_path(self):
4167 def _get_hg_py_path(self):
4134 """Return the path to the mercurial package that is actually found by
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