Patchwork D11045: run-tests: cleanup windows generation of the python / python3 pointeur

login
register
mail settings
Submitter phabricator
Date July 10, 2021, 12:38 a.m.
Message ID <differential-rev-PHID-DREV-3x6kr37wc3xzminb6hqy-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49361/
State Superseded
Headers show

Comments

phabricator - July 10, 2021, 12:38 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  They are no need to generate then in RUNTESTDIR and we don't need a python2
  executable. (because not test ever use `python2` explicitly)

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11045

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3587,13 +3587,15 @@ 
             # simple script on PATH with that name that delegates to the py3
             # launcher so the shebang lines work.
             if os.getenv('MSYSTEM'):
-                with open(osenvironb[b'RUNTESTDIR'] + b'/python3', 'wb') as f:
+                py3exe_name = os.path.join(self._custom_bin_dir, b'python3')
+                with open(py3exe_name, 'wb') as f:
                     f.write(b'#!/bin/sh\n')
                     f.write(b'py -3.%d "$@"\n' % sys.version_info[1])
-            if os.getenv('MSYSTEM'):
-                with open(osenvironb[b'RUNTESTDIR'] + b'/python2', 'wb') as f:
+
+                pyexe_name = os.path.join(self._custom_bin_dir, b'python2')
+                with open(pyexe_name, 'wb') as f:
                     f.write(b'#!/bin/sh\n')
-                    f.write(b'py -2.%d "$@"\n' % sys.version_info[1])
+                    f.write(b'py -%d.%d "$@"\n' % sys.version_info[0:2])
 
             exedir, exename = os.path.split(sysexecutable)
             for pyexename in pyexe_names: