aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Tools-Demos/2020-12-16-09-10-32.bpo-42613.J-jnm5.rst2
-rwxr-xr-xTools/freeze/freeze.py20
2 files changed, 12 insertions, 10 deletions
diff --git a/Misc/NEWS.d/next/Tools-Demos/2020-12-16-09-10-32.bpo-42613.J-jnm5.rst b/Misc/NEWS.d/next/Tools-Demos/2020-12-16-09-10-32.bpo-42613.J-jnm5.rst
new file mode 100644
index 00000000000..140ff8255b9
--- /dev/null
+++ b/Misc/NEWS.d/next/Tools-Demos/2020-12-16-09-10-32.bpo-42613.J-jnm5.rst
@@ -0,0 +1,2 @@
+Fix ``freeze.py`` tool to use the prope config and library directories.
+Patch by Victor Stinner.
diff --git a/Tools/freeze/freeze.py b/Tools/freeze/freeze.py
index 83aa508a46a..d66e1e2708e 100755
--- a/Tools/freeze/freeze.py
+++ b/Tools/freeze/freeze.py
@@ -93,6 +93,7 @@ import modulefinder
import getopt
import os
import sys
+import sysconfig
# Import the freeze-private modules
@@ -226,7 +227,7 @@ def main():
extensions_c = 'frozen_extensions.c'
if ishome:
print("(Using Python source directory)")
- binlib = exec_prefix
+ configdir = exec_prefix
incldir = os.path.join(prefix, 'Include')
config_h_dir = exec_prefix
config_c_in = os.path.join(prefix, 'Modules', 'config.c.in')
@@ -235,22 +236,21 @@ def main():
if win:
frozendllmain_c = os.path.join(exec_prefix, 'Pc\\frozen_dllmain.c')
else:
- binlib = os.path.join(exec_prefix,
- 'lib', 'python%s' % version,
- 'config-%s' % flagged_version)
+ configdir = sysconfig.get_config_var('LIBPL')
incldir = os.path.join(prefix, 'include', 'python%s' % flagged_version)
config_h_dir = os.path.join(exec_prefix, 'include',
'python%s' % flagged_version)
- config_c_in = os.path.join(binlib, 'config.c.in')
- frozenmain_c = os.path.join(binlib, 'frozenmain.c')
- makefile_in = os.path.join(binlib, 'Makefile')
- frozendllmain_c = os.path.join(binlib, 'frozen_dllmain.c')
+ config_c_in = os.path.join(configdir, 'config.c.in')
+ frozenmain_c = os.path.join(configdir, 'frozenmain.c')
+ makefile_in = os.path.join(configdir, 'Makefile')
+ frozendllmain_c = os.path.join(configdir, 'frozen_dllmain.c')
+ libdir = sysconfig.get_config_var('LIBDIR')
supp_sources = []
defines = []
includes = ['-I' + incldir, '-I' + config_h_dir]
# sanity check of directories and files
- check_dirs = [prefix, exec_prefix, binlib, incldir]
+ check_dirs = [prefix, exec_prefix, configdir, incldir]
if not win:
# These are not directories on Windows.
check_dirs = check_dirs + extensions
@@ -457,7 +457,7 @@ def main():
cflags = ['$(OPT)']
cppflags = defines + includes
- libs = [os.path.join(binlib, '$(LDLIBRARY)')]
+ libs = [os.path.join(libdir, '$(LDLIBRARY)')]
somevars = {}
if os.path.exists(makefile_in):