bpo-42613: Fix freeze.py config directory (GH-23792)
Fix freeze.py tool to use the prope config and library directories.
This commit is contained in:
parent
99d28c5670
commit
1c653f17cb
|
@ -0,0 +1,2 @@
|
||||||
|
Fix ``freeze.py`` tool to use the prope config and library directories.
|
||||||
|
Patch by Victor Stinner.
|
|
@ -93,6 +93,7 @@ import modulefinder
|
||||||
import getopt
|
import getopt
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import sysconfig
|
||||||
|
|
||||||
|
|
||||||
# Import the freeze-private modules
|
# Import the freeze-private modules
|
||||||
|
@ -226,7 +227,7 @@ def main():
|
||||||
extensions_c = 'frozen_extensions.c'
|
extensions_c = 'frozen_extensions.c'
|
||||||
if ishome:
|
if ishome:
|
||||||
print("(Using Python source directory)")
|
print("(Using Python source directory)")
|
||||||
binlib = exec_prefix
|
configdir = exec_prefix
|
||||||
incldir = os.path.join(prefix, 'Include')
|
incldir = os.path.join(prefix, 'Include')
|
||||||
config_h_dir = exec_prefix
|
config_h_dir = exec_prefix
|
||||||
config_c_in = os.path.join(prefix, 'Modules', 'config.c.in')
|
config_c_in = os.path.join(prefix, 'Modules', 'config.c.in')
|
||||||
|
@ -235,22 +236,21 @@ def main():
|
||||||
if win:
|
if win:
|
||||||
frozendllmain_c = os.path.join(exec_prefix, 'Pc\\frozen_dllmain.c')
|
frozendllmain_c = os.path.join(exec_prefix, 'Pc\\frozen_dllmain.c')
|
||||||
else:
|
else:
|
||||||
binlib = os.path.join(exec_prefix,
|
configdir = sysconfig.get_config_var('LIBPL')
|
||||||
'lib', 'python%s' % version,
|
|
||||||
'config-%s' % flagged_version)
|
|
||||||
incldir = os.path.join(prefix, 'include', 'python%s' % flagged_version)
|
incldir = os.path.join(prefix, 'include', 'python%s' % flagged_version)
|
||||||
config_h_dir = os.path.join(exec_prefix, 'include',
|
config_h_dir = os.path.join(exec_prefix, 'include',
|
||||||
'python%s' % flagged_version)
|
'python%s' % flagged_version)
|
||||||
config_c_in = os.path.join(binlib, 'config.c.in')
|
config_c_in = os.path.join(configdir, 'config.c.in')
|
||||||
frozenmain_c = os.path.join(binlib, 'frozenmain.c')
|
frozenmain_c = os.path.join(configdir, 'frozenmain.c')
|
||||||
makefile_in = os.path.join(binlib, 'Makefile')
|
makefile_in = os.path.join(configdir, 'Makefile')
|
||||||
frozendllmain_c = os.path.join(binlib, 'frozen_dllmain.c')
|
frozendllmain_c = os.path.join(configdir, 'frozen_dllmain.c')
|
||||||
|
libdir = sysconfig.get_config_var('LIBDIR')
|
||||||
supp_sources = []
|
supp_sources = []
|
||||||
defines = []
|
defines = []
|
||||||
includes = ['-I' + incldir, '-I' + config_h_dir]
|
includes = ['-I' + incldir, '-I' + config_h_dir]
|
||||||
|
|
||||||
# sanity check of directories and files
|
# sanity check of directories and files
|
||||||
check_dirs = [prefix, exec_prefix, binlib, incldir]
|
check_dirs = [prefix, exec_prefix, configdir, incldir]
|
||||||
if not win:
|
if not win:
|
||||||
# These are not directories on Windows.
|
# These are not directories on Windows.
|
||||||
check_dirs = check_dirs + extensions
|
check_dirs = check_dirs + extensions
|
||||||
|
@ -457,7 +457,7 @@ def main():
|
||||||
|
|
||||||
cflags = ['$(OPT)']
|
cflags = ['$(OPT)']
|
||||||
cppflags = defines + includes
|
cppflags = defines + includes
|
||||||
libs = [os.path.join(binlib, '$(LDLIBRARY)')]
|
libs = [os.path.join(libdir, '$(LDLIBRARY)')]
|
||||||
|
|
||||||
somevars = {}
|
somevars = {}
|
||||||
if os.path.exists(makefile_in):
|
if os.path.exists(makefile_in):
|
||||||
|
|
Loading…
Reference in New Issue