~ubuntu-branches/ubuntu/wily/mercurial/wily

« back to all changes in this revision

Viewing changes to .pc/for_upstream__dont_rm_usr_bin_python_when_running_testsuite.patch/tests/run-tests.py

  • Committer: Package Import Robot
  • Author(s): Javi Merino
  • Date: 2013-11-01 23:19:57 UTC
  • mfrom: (1.2.38) (9.1.16 experimental)
  • Revision ID: package-import@ubuntu.com-20131101231957-hs70pwpinavlz3t6
Tags: 2.8-1
* New upstream release
* Fix mercurial-git and hgsubversion autopkgtest by loading the
  appropriate extension
* Bump standards-version to 3.9.5 (no change needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
341
341
    hgrc.write('[defaults]\n')
342
342
    hgrc.write('backout = -d "0 0"\n')
343
343
    hgrc.write('commit = -d "0 0"\n')
 
344
    hgrc.write('shelve = --date "0 0"\n')
344
345
    hgrc.write('tag = -d "0 0"\n')
345
346
    if options.inotify:
346
347
        hgrc.write('[extensions]\n')
460
461
    if options.compiler:
461
462
        compiler = '--compiler ' + options.compiler
462
463
    pure = options.pure and "--pure" or ""
 
464
    py3 = ''
 
465
    if sys.version_info[0] == 3:
 
466
        py3 = '--c2to3'
463
467
 
464
468
    # Run installer in hg root
465
469
    script = os.path.realpath(sys.argv[0])
472
476
        # least on Windows for now, deal with .pydistutils.cfg bugs
473
477
        # when they happen.
474
478
        nohome = ''
475
 
    cmd = ('%(exe)s setup.py %(pure)s clean --all'
 
479
    cmd = ('%(exe)s setup.py %(py3)s %(pure)s clean --all'
476
480
           ' build %(compiler)s --build-base="%(base)s"'
477
481
           ' install --force --prefix="%(prefix)s" --install-lib="%(libdir)s"'
478
482
           ' --install-scripts="%(bindir)s" %(nohome)s >%(logfile)s 2>&1'
479
 
           % dict(exe=sys.executable, pure=pure, compiler=compiler,
 
483
           % dict(exe=sys.executable, py3=py3, pure=pure, compiler=compiler,
480
484
                  base=os.path.join(HGTMP, "build"),
481
485
                  prefix=INST, libdir=PYTHONDIR, bindir=BINDIR,
482
486
                  nohome=nohome, logfile=installerrs))
758
762
    addsalt(n + 1, False)
759
763
 
760
764
    # Write out the script and execute it
761
 
    fd, name = tempfile.mkstemp(suffix='hg-tst')
762
 
    try:
763
 
        for l in script:
764
 
            os.write(fd, l)
765
 
        os.close(fd)
 
765
    name = wd + '.sh'
 
766
    f = open(name, 'w')
 
767
    for l in script:
 
768
        f.write(l)
 
769
    f.close()
766
770
 
767
 
        cmd = '%s "%s"' % (options.shell, name)
768
 
        vlog("# Running", cmd)
769
 
        exitcode, output = run(cmd, wd, options, replacements, env)
770
 
        # do not merge output if skipped, return hghave message instead
771
 
        # similarly, with --debug, output is None
772
 
        if exitcode == SKIPPED_STATUS or output is None:
773
 
            return exitcode, output
774
 
    finally:
775
 
        os.remove(name)
 
771
    cmd = '%s "%s"' % (options.shell, name)
 
772
    vlog("# Running", cmd)
 
773
    exitcode, output = run(cmd, wd, options, replacements, env)
 
774
    # do not merge output if skipped, return hghave message instead
 
775
    # similarly, with --debug, output is None
 
776
    if exitcode == SKIPPED_STATUS or output is None:
 
777
        return exitcode, output
776
778
 
777
779
    # Merge the script output back into a unified test
778
780
 
921
923
                else:
922
924
                    return ignore("doesn't match keyword")
923
925
 
 
926
    if not lctest.startswith("test-"):
 
927
        return skip("not a test file")
924
928
    for ext, func, out in testtypes:
925
 
        if lctest.startswith("test-") and lctest.endswith(ext):
 
929
        if lctest.endswith(ext):
926
930
            runner = func
927
931
            ref = os.path.join(TESTDIR, test + out)
928
932
            break
1043
1047
    if _hgpath is not None:
1044
1048
        return _hgpath
1045
1049
 
1046
 
    cmd = '%s -c "import mercurial; print mercurial.__path__[0]"'
 
1050
    cmd = '%s -c "import mercurial; print (mercurial.__path__[0])"'
1047
1051
    pipe = os.popen(cmd % PYTHON)
1048
1052
    try:
1049
1053
        _hgpath = pipe.read().strip()