]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45402: Fix test_tools.test_sundry() (GH-28786)
authorVictor Stinner <vstinner@python.org>
Thu, 7 Oct 2021 19:19:13 +0000 (21:19 +0200)
committerGitHub <noreply@github.com>
Thu, 7 Oct 2021 19:19:13 +0000 (21:19 +0200)
Fix test_tools.test_sundry() when Python is built out of tree: fix
how the freeze_modules.py tool locates the _freeze_module program.

Misc/NEWS.d/next/Tests/2021-10-07-13-43-01.bpo-45402.jlQvep.rst [new file with mode: 0644]
Tools/scripts/freeze_modules.py

diff --git a/Misc/NEWS.d/next/Tests/2021-10-07-13-43-01.bpo-45402.jlQvep.rst b/Misc/NEWS.d/next/Tests/2021-10-07-13-43-01.bpo-45402.jlQvep.rst
new file mode 100644 (file)
index 0000000..d8c6553
--- /dev/null
@@ -0,0 +1,3 @@
+Fix test_tools.test_sundry() when Python is built out of tree: fix how
+the freeze_modules.py tool locates the _freeze_module program.
+Patch by Victor Stinner.
index 36e284100ed52cb0c816e0559d7b0cc423e811bd..5c7eee429528969032c0d0b1a68636a5604fe2a7 100644 (file)
@@ -29,9 +29,10 @@ MODULES_DIR = os.path.join(ROOT_DIR, 'Python', 'frozen_modules')
 if sys.platform != "win32":
     TOOL = os.path.join(ROOT_DIR, 'Programs', '_freeze_module')
     if not os.path.isfile(TOOL):
-        # When building out of the source tree, get the tool from the current
-        # directory
-        TOOL = os.path.join('Programs', '_freeze_module')
+        # When building out of the source tree, get the tool from directory
+        # of the Python executable
+        TOOL = os.path.dirname(sys.executable)
+        TOOL = os.path.join(TOOL, 'Programs', '_freeze_module')
         TOOL = os.path.abspath(TOOL)
         if not os.path.isfile(TOOL):
             sys.exit("ERROR: missing _freeze_module")