##// END OF EJS Templates
run-tests: move BINDIR out of a global
Gregory Szorc -
r21344:2e1aa8c1 default
parent child Browse files
Show More
@@ -460,7 +460,8 b' def installhg(runner, options):'
460 460 ' --install-scripts="%(bindir)s" %(nohome)s >%(logfile)s 2>&1'
461 461 % {'exe': sys.executable, 'py3': py3, 'pure': pure,
462 462 'compiler': compiler, 'base': os.path.join(runner.hgtmp, "build"),
463 'prefix': runner.inst, 'libdir': PYTHONDIR, 'bindir': BINDIR,
463 'prefix': runner.inst, 'libdir': PYTHONDIR,
464 'bindir': runner.bindir,
464 465 'nohome': nohome, 'logfile': installerrs})
465 466 vlog("# Running", cmd)
466 467 if os.system(cmd) == 0:
@@ -478,16 +479,16 b' def installhg(runner, options):'
478 479
479 480 if options.py3k_warnings and not options.anycoverage:
480 481 vlog("# Updating hg command to enable Py3k Warnings switch")
481 f = open(os.path.join(BINDIR, 'hg'), 'r')
482 f = open(os.path.join(runner.bindir, 'hg'), 'r')
482 483 lines = [line.rstrip() for line in f]
483 484 lines[0] += ' -3'
484 485 f.close()
485 f = open(os.path.join(BINDIR, 'hg'), 'w')
486 f = open(os.path.join(runner.bindir, 'hg'), 'w')
486 487 for line in lines:
487 488 f.write(line + '\n')
488 489 f.close()
489 490
490 hgbat = os.path.join(BINDIR, 'hg.bat')
491 hgbat = os.path.join(runner.bindir, 'hg.bat')
491 492 if os.path.isfile(hgbat):
492 493 # hg.bat expects to be put in bin/scripts while run-tests.py
493 494 # installation layout put it in bin/ directly. Fix it
@@ -533,7 +534,8 b' def outputcoverage(runner, options):'
533 534 os.system(cmd)
534 535
535 536 covrun('-c')
536 omit = ','.join(os.path.join(x, '*') for x in [BINDIR, runner.testdir])
537 omit = ','.join(os.path.join(x, '*') for x in
538 [runner.bindir, runner.testdir])
537 539 covrun('-i', '-r', '"--omit=%s"' % omit) # report
538 540 if options.htmlcov:
539 541 htmldir = os.path.join(runner.testdir, 'htmlcov')
@@ -1288,6 +1290,7 b' class TestRunner(object):'
1288 1290 self.testdir = None
1289 1291 self.hgtmp = None
1290 1292 self.inst = None
1293 self.bindir = None
1291 1294
1292 1295 def main(args, parser=None):
1293 1296 runner = TestRunner()
@@ -1335,7 +1338,7 b' def main(args, parser=None):'
1335 1338 # we do the randomness ourself to know what seed is used
1336 1339 os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32))
1337 1340
1338 global BINDIR, TMPBINDIR, PYTHONDIR, COVERAGE_FILE
1341 global TMPBINDIR, PYTHONDIR, COVERAGE_FILE
1339 1342 runner.testdir = os.environ['TESTDIR'] = os.getcwd()
1340 1343 if options.tmpdir:
1341 1344 options.keep_tmpdir = True
@@ -1364,7 +1367,7 b' def main(args, parser=None):'
1364 1367
1365 1368 if options.with_hg:
1366 1369 runner.inst = None
1367 BINDIR = os.path.dirname(os.path.realpath(options.with_hg))
1370 runner.bindir = os.path.dirname(os.path.realpath(options.with_hg))
1368 1371 TMPBINDIR = os.path.join(runner.hgtmp, 'install', 'bin')
1369 1372 os.makedirs(TMPBINDIR)
1370 1373
@@ -1373,18 +1376,19 b' def main(args, parser=None):'
1373 1376 # "hg" specified by --with-hg is not the only Python script
1374 1377 # executed in the test suite that needs to import 'mercurial'
1375 1378 # ... which means it's not really redundant at all.
1376 PYTHONDIR = BINDIR
1379 PYTHONDIR = runner.bindir
1377 1380 else:
1378 1381 runner.inst = os.path.join(runner.hgtmp, "install")
1379 BINDIR = os.environ["BINDIR"] = os.path.join(runner.inst, "bin")
1380 TMPBINDIR = BINDIR
1382 runner.bindir = os.environ["BINDIR"] = os.path.join(runner.inst,
1383 "bin")
1384 TMPBINDIR = runner.bindir
1381 1385 PYTHONDIR = os.path.join(runner.inst, "lib", "python")
1382 1386
1383 os.environ["BINDIR"] = BINDIR
1387 os.environ["BINDIR"] = runner.bindir
1384 1388 os.environ["PYTHON"] = PYTHON
1385 1389
1386 path = [BINDIR] + os.environ["PATH"].split(os.pathsep)
1387 if TMPBINDIR != BINDIR:
1390 path = [runner.bindir] + os.environ["PATH"].split(os.pathsep)
1391 if TMPBINDIR != runner.bindir:
1388 1392 path = [TMPBINDIR] + path
1389 1393 os.environ["PATH"] = os.pathsep.join(path)
1390 1394
General Comments 0
You need to be logged in to leave comments. Login now