tests/run-tests.py
changeset 47503 9d929f9cb9b4
parent 47502 50829b9149b0
child 47505 23f5ed6dbcb1
equal deleted inserted replaced
47502:50829b9149b0 47503:9d929f9cb9b4
  3538         # Administrator rights.
  3538         # Administrator rights.
  3539         if getattr(os, 'symlink', None) and os.name != 'nt':
  3539         if getattr(os, 'symlink', None) and os.name != 'nt':
  3540             msg = "# Making python executable in test path a symlink to '%s'"
  3540             msg = "# Making python executable in test path a symlink to '%s'"
  3541             msg %= sysexecutable
  3541             msg %= sysexecutable
  3542             vlog(msg)
  3542             vlog(msg)
  3543             mypython = os.path.join(self._tmpbindir, pyexename)
  3543             for pyexename in [pyexename]:
  3544             try:
  3544                 mypython = os.path.join(self._tmpbindir, pyexename)
  3545                 if os.readlink(mypython) == sysexecutable:
       
  3546                     return
       
  3547                 os.unlink(mypython)
       
  3548             except OSError as err:
       
  3549                 if err.errno != errno.ENOENT:
       
  3550                     raise
       
  3551             if self._findprogram(pyexename) != sysexecutable:
       
  3552                 try:
  3545                 try:
  3553                     os.symlink(sysexecutable, mypython)
  3546                     if os.readlink(mypython) == sysexecutable:
  3554                     self._createdfiles.append(mypython)
  3547                         continue
       
  3548                     os.unlink(mypython)
  3555                 except OSError as err:
  3549                 except OSError as err:
  3556                     # child processes may race, which is harmless
  3550                     if err.errno != errno.ENOENT:
  3557                     if err.errno != errno.EEXIST:
       
  3558                         raise
  3551                         raise
       
  3552                 if self._findprogram(pyexename) != sysexecutable:
       
  3553                     try:
       
  3554                         os.symlink(sysexecutable, mypython)
       
  3555                         self._createdfiles.append(mypython)
       
  3556                     except OSError as err:
       
  3557                         # child processes may race, which is harmless
       
  3558                         if err.errno != errno.EEXIST:
       
  3559                             raise
  3559         else:
  3560         else:
  3560             # Windows doesn't have `python3.exe`, and MSYS cannot understand the
  3561             # Windows doesn't have `python3.exe`, and MSYS cannot understand the
  3561             # reparse point with that name provided by Microsoft.  Create a
  3562             # reparse point with that name provided by Microsoft.  Create a
  3562             # simple script on PATH with that name that delegates to the py3
  3563             # simple script on PATH with that name that delegates to the py3
  3563             # launcher so the shebang lines work.
  3564             # launcher so the shebang lines work.