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