tests/run-tests.py
changeset 40930 fcdff048a8e5
parent 40491 c311424ea579
child 40975 2465e0b27a0d
equal deleted inserted replaced
40929:43ca24b772d6 40930:fcdff048a8e5
  3017             # The --home="" trick works only on OS where os.sep == '/'
  3017             # The --home="" trick works only on OS where os.sep == '/'
  3018             # because of a distutils convert_path() fast-path. Avoid it at
  3018             # because of a distutils convert_path() fast-path. Avoid it at
  3019             # least on Windows for now, deal with .pydistutils.cfg bugs
  3019             # least on Windows for now, deal with .pydistutils.cfg bugs
  3020             # when they happen.
  3020             # when they happen.
  3021             nohome = b''
  3021             nohome = b''
  3022         cmd = (b'%(exe)s setup.py %(pure)s clean --all'
  3022         cmd = (b'"%(exe)s" setup.py %(pure)s clean --all'
  3023                b' build %(compiler)s --build-base="%(base)s"'
  3023                b' build %(compiler)s --build-base="%(base)s"'
  3024                b' install --force --prefix="%(prefix)s"'
  3024                b' install --force --prefix="%(prefix)s"'
  3025                b' --install-lib="%(libdir)s"'
  3025                b' --install-lib="%(libdir)s"'
  3026                b' --install-scripts="%(bindir)s" %(nohome)s >%(logfile)s 2>&1'
  3026                b' --install-scripts="%(bindir)s" %(nohome)s >%(logfile)s 2>&1'
  3027                % {b'exe': exe, b'pure': pure,
  3027                % {b'exe': exe, b'pure': pure,
  3040                     raise
  3040                     raise
  3041         makedirs(self._pythondir)
  3041         makedirs(self._pythondir)
  3042         makedirs(self._bindir)
  3042         makedirs(self._bindir)
  3043 
  3043 
  3044         vlog("# Running", cmd)
  3044         vlog("# Running", cmd)
  3045         if os.system(_strpath(cmd)) == 0:
  3045         if subprocess.call(_strpath(cmd), shell=True) == 0:
  3046             if not self.options.verbose:
  3046             if not self.options.verbose:
  3047                 try:
  3047                 try:
  3048                     os.remove(installerrs)
  3048                     os.remove(installerrs)
  3049                 except OSError as e:
  3049                 except OSError as e:
  3050                     if e.errno != errno.ENOENT:
  3050                     if e.errno != errno.ENOENT:
  3119         """Return the path to the mercurial package that is actually found by
  3119         """Return the path to the mercurial package that is actually found by
  3120         the current Python interpreter."""
  3120         the current Python interpreter."""
  3121         if self._hgpath is not None:
  3121         if self._hgpath is not None:
  3122             return self._hgpath
  3122             return self._hgpath
  3123 
  3123 
  3124         cmd = b'%s -c "import mercurial; print (mercurial.__path__[0])"'
  3124         cmd = b'"%s" -c "import mercurial; print (mercurial.__path__[0])"'
  3125         cmd = cmd % PYTHON
  3125         cmd = cmd % PYTHON
  3126         if PYTHON3:
  3126         if PYTHON3:
  3127             cmd = _strpath(cmd)
  3127             cmd = _strpath(cmd)
  3128         pipe = os.popen(cmd)
  3128 
  3129         try:
  3129         p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
  3130             self._hgpath = _bytespath(pipe.read().strip())
  3130         out, err = p.communicate()
  3131         finally:
  3131 
  3132             pipe.close()
  3132         self._hgpath = out.strip()
  3133 
  3133 
  3134         return self._hgpath
  3134         return self._hgpath
  3135 
  3135 
  3136     def _installchg(self):
  3136     def _installchg(self):
  3137         """Install chg into the test environment"""
  3137         """Install chg into the test environment"""