# HG changeset patch # User Siddharth Agarwal # Date 1392874334 28800 # Node ID 958582800276d9395d5bc6d7a9982d9cece7bfcc # Parent c559280de767e2b7ec2ec247c542b2741a4a6351 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. [ original upstream message ] diff -r c559280de767 -r 958582800276 tests/run-tests.py --- a/tests/run-tests.py Sat Feb 15 15:28:32 2014 +0100 +++ 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