# HG changeset patch # User Siddharth Agarwal # Date 1392874334 28800 # Node ID 44dcca9be1d5c45aa802abdcb5ebf4c2f24e64f4 # Parent fa16c710a3d812cf244365b0d0dceb2c386ab666 run-tests.py: work when --with-hg is set to system hg Previously we'd always assume that --with-hg is a script in a user directory, and would write out a 'python' symlink to the same location. That didn't work if --with-hg was set to a system installation of hg, e.g. /usr/bin/hg. Introduce a TMPBINDIR directory which is used to write out the python symlink. diff -r fa16c710a3d8 -r 44dcca9be1d5 tests/run-tests.py --- a/tests/run-tests.py Wed Feb 12 18:45:49 2014 -0800 +++ b/tests/run-tests.py Wed Feb 19 21:32:14 2014 -0800 @@ -434,7 +434,7 @@ if getattr(os, 'symlink', None): vlog("# Making python executable in test path a symlink to '%s'" % sys.executable) - mypython = os.path.join(BINDIR, pyexename) + mypython = os.path.join(TMPBINDIR, pyexename) try: if os.readlink(mypython) == sys.executable: return @@ -1215,7 +1215,7 @@ # we do the randomness ourself to know what seed is used os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32)) - global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE + global TESTDIR, HGTMP, INST, BINDIR, TMPBINDIR, PYTHONDIR, COVERAGE_FILE TESTDIR = os.environ["TESTDIR"] = os.getcwd() if options.tmpdir: options.keep_tmpdir = True @@ -1244,6 +1244,8 @@ if options.with_hg: INST = None BINDIR = os.path.dirname(os.path.realpath(options.with_hg)) + TMPBINDIR = os.path.join(HGTMP, 'install', 'bin') + os.makedirs(TMPBINDIR) # This looks redundant with how Python initializes sys.path from # the location of the script being executed. Needed because the @@ -1254,12 +1256,15 @@ else: INST = os.path.join(HGTMP, "install") BINDIR = os.environ["BINDIR"] = os.path.join(INST, "bin") + TMPBINDIR = BINDIR PYTHONDIR = os.path.join(INST, "lib", "python") os.environ["BINDIR"] = BINDIR os.environ["PYTHON"] = PYTHON path = [BINDIR] + os.environ["PATH"].split(os.pathsep) + if TMPBINDIR != BINDIR: + path = [TMPBINDIR] + path os.environ["PATH"] = os.pathsep.join(path) # Include TESTDIR in PYTHONPATH so that out-of-tree extensions