summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-10-07 19:19:13 (GMT)
committerGitHub <noreply@github.com>2021-10-07 19:19:13 (GMT)
commitff8859d965815e8b5af346bd90299cfa5568c855 (patch)
tree7a69ac5bc1af96f02278975da2dfbca2d4a01756
parent32485cecab0111a858055b7a60df3b9903b162e3 (diff)
downloadcpython-ff8859d965815e8b5af346bd90299cfa5568c855.zip
cpython-ff8859d965815e8b5af346bd90299cfa5568c855.tar.gz
cpython-ff8859d965815e8b5af346bd90299cfa5568c855.tar.bz2
bpo-45402: Fix test_tools.test_sundry() (GH-28786)
Fix test_tools.test_sundry() when Python is built out of tree: fix how the freeze_modules.py tool locates the _freeze_module program.
-rw-r--r--Misc/NEWS.d/next/Tests/2021-10-07-13-43-01.bpo-45402.jlQvep.rst3
-rw-r--r--Tools/scripts/freeze_modules.py7
2 files changed, 7 insertions, 3 deletions
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
index 0000000..d8c6553
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2021-10-07-13-43-01.bpo-45402.jlQvep.rst
@@ -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.
diff --git a/Tools/scripts/freeze_modules.py b/Tools/scripts/freeze_modules.py
index 36e2841..5c7eee4 100644
--- a/Tools/scripts/freeze_modules.py
+++ b/Tools/scripts/freeze_modules.py
@@ -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")