Skip to content

Commit fb3f5b2

Browse files
committed
Limit f2py symbol renaming. Ignore deleted module
1 parent e8ab3e3 commit fb3f5b2

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

Lib/__np__/darwin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def rename_init_symbol_in_file(target_lib):
7878
for sym in obj_symbols:
7979
if sym[0].startswith("PyInit_") or sym[0].startswith("_PyInit_") or \
8080
"pyx_CommonTypesMetaclass" in sym[0] or \
81-
"_f2py_" in sym[0] or \
81+
"f2pyinittypes" in sym[0] or \
8282
("pybind11" in sym[0] and '@' not in sym[0] and '?' not in sym[0]):
8383
symbols_to_rename.add(sym[0])
8484

Lib/__np__/linux.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def rename_init_symbol_in_file(target_lib):
128128
for sym_name, full_line in obj_symbols:
129129
if (sym_name.startswith("PyInit_") or sym_name.startswith("_PyInit_") or
130130
"pyx_CommonTypesMetaclass" in sym_name or
131-
"_f2py_" in sym_name or
131+
"f2pyinittypes" in sym_name or
132132
("pybind11" in sym_name and '@' not in sym_name and '?' not in sym_name)) and \
133133
not (' U ' in full_line or full_line.strip().startswith('U ')):
134134
symbols_to_rename_map[sym_name] = f"{sym_name}__np__{file_hash}"

Lib/__np__/windows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def rename_init_symbol_in_file(target_lib):
232232
# Check if it's a PyInit symbol and if it's defined (not 'U')
233233
if (sym_name.startswith("PyInit_") or sym_name.startswith("_PyInit_") or
234234
"pyx_CommonTypesMetaclass" in sym_name or
235-
"_f2py_" in sym_name or
235+
"f2pyinittypes" in sym_name or
236236
("pybind11" in sym_name and '@' not in sym_name and '?' not in sym_name)) and \
237237
not (' u ' in line.lower() or line.lower().startswith('u ')):
238238
symbols_to_rename_map[sym_name] = f"{sym_name}__np__{file_hash}"

Lib/rebuildpython.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ def run_rebuild():
175175
if normalized_file in checkedLibs:
176176
continue
177177

178+
if not is_lib_valid(normalized_file):
179+
continue
180+
178181
filename_base = os.path.basename(file)
179182

180183
python_lib = sysconfig.get_config_var("LIBRARY")
@@ -538,6 +541,7 @@ def run_rebuild():
538541
link_libs = sysconfig_libs + link_libs
539542
libpython_lib = [x for x in link_libs if os.path.basename(x).startswith('libpython') and x.endswith(".a")][0]
540543
link_libs = [libpython_lib] + [x for x in link_libs if x != libpython_lib]
544+
link_libs = [x for x in link_libs if is_lib_valid(x)]
541545
library_dirs = sysconfig_lib_dirs + library_dirs
542546

543547
compiler.compile(
@@ -596,6 +600,7 @@ def run_rebuild():
596600
link_libs = sysconfig_libs + link_libs
597601
libpython_lib = [x for x in link_libs if os.path.basename(x).startswith('libpython') and x.endswith(".a")][0]
598602
link_libs = [libpython_lib] + [x for x in link_libs if x != libpython_lib]
603+
link_libs = [x for x in link_libs if is_lib_valid(x)]
599604
library_dirs = [x for x in sysconfig_lib_dirs + library_dirs if 'Nuitka-Python-Deps' not in x]
600605

601606
os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.9"

0 commit comments

Comments
 (0)