# HG changeset patch # User Gregory Szorc # Date 1397974967 25200 # Node ID 2e1aa8c1ee37e9df9a589c600f609245a73134c0 # Parent 93511a5957665b91dba0aeb59f5e91da54ad414c run-tests: move BINDIR out of a global diff -r 93511a595766 -r 2e1aa8c1ee37 tests/run-tests.py --- a/tests/run-tests.py Sat Apr 19 23:20:42 2014 -0700 +++ b/tests/run-tests.py Sat Apr 19 23:22:47 2014 -0700 @@ -460,7 +460,8 @@ ' --install-scripts="%(bindir)s" %(nohome)s >%(logfile)s 2>&1' % {'exe': sys.executable, 'py3': py3, 'pure': pure, 'compiler': compiler, 'base': os.path.join(runner.hgtmp, "build"), - 'prefix': runner.inst, 'libdir': PYTHONDIR, 'bindir': BINDIR, + 'prefix': runner.inst, 'libdir': PYTHONDIR, + 'bindir': runner.bindir, 'nohome': nohome, 'logfile': installerrs}) vlog("# Running", cmd) if os.system(cmd) == 0: @@ -478,16 +479,16 @@ if options.py3k_warnings and not options.anycoverage: vlog("# Updating hg command to enable Py3k Warnings switch") - f = open(os.path.join(BINDIR, 'hg'), 'r') + f = open(os.path.join(runner.bindir, 'hg'), 'r') lines = [line.rstrip() for line in f] lines[0] += ' -3' f.close() - f = open(os.path.join(BINDIR, 'hg'), 'w') + f = open(os.path.join(runner.bindir, 'hg'), 'w') for line in lines: f.write(line + '\n') f.close() - hgbat = os.path.join(BINDIR, 'hg.bat') + hgbat = os.path.join(runner.bindir, 'hg.bat') if os.path.isfile(hgbat): # hg.bat expects to be put in bin/scripts while run-tests.py # installation layout put it in bin/ directly. Fix it @@ -533,7 +534,8 @@ os.system(cmd) covrun('-c') - omit = ','.join(os.path.join(x, '*') for x in [BINDIR, runner.testdir]) + omit = ','.join(os.path.join(x, '*') for x in + [runner.bindir, runner.testdir]) covrun('-i', '-r', '"--omit=%s"' % omit) # report if options.htmlcov: htmldir = os.path.join(runner.testdir, 'htmlcov') @@ -1288,6 +1290,7 @@ self.testdir = None self.hgtmp = None self.inst = None + self.bindir = None def main(args, parser=None): runner = TestRunner() @@ -1335,7 +1338,7 @@ # we do the randomness ourself to know what seed is used os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32)) - global BINDIR, TMPBINDIR, PYTHONDIR, COVERAGE_FILE + global TMPBINDIR, PYTHONDIR, COVERAGE_FILE runner.testdir = os.environ['TESTDIR'] = os.getcwd() if options.tmpdir: options.keep_tmpdir = True @@ -1364,7 +1367,7 @@ if options.with_hg: runner.inst = None - BINDIR = os.path.dirname(os.path.realpath(options.with_hg)) + runner.bindir = os.path.dirname(os.path.realpath(options.with_hg)) TMPBINDIR = os.path.join(runner.hgtmp, 'install', 'bin') os.makedirs(TMPBINDIR) @@ -1373,18 +1376,19 @@ # "hg" specified by --with-hg is not the only Python script # executed in the test suite that needs to import 'mercurial' # ... which means it's not really redundant at all. - PYTHONDIR = BINDIR + PYTHONDIR = runner.bindir else: runner.inst = os.path.join(runner.hgtmp, "install") - BINDIR = os.environ["BINDIR"] = os.path.join(runner.inst, "bin") - TMPBINDIR = BINDIR + runner.bindir = os.environ["BINDIR"] = os.path.join(runner.inst, + "bin") + TMPBINDIR = runner.bindir PYTHONDIR = os.path.join(runner.inst, "lib", "python") - os.environ["BINDIR"] = BINDIR + os.environ["BINDIR"] = runner.bindir os.environ["PYTHON"] = PYTHON - path = [BINDIR] + os.environ["PATH"].split(os.pathsep) - if TMPBINDIR != BINDIR: + path = [runner.bindir] + os.environ["PATH"].split(os.pathsep) + if TMPBINDIR != runner.bindir: path = [TMPBINDIR] + path os.environ["PATH"] = os.pathsep.join(path)