From e1425a4cdffcd493cbfb72d8a87fd382796eac0e Mon Sep 17 00:00:00 2001 From: Danilo Gonzalez Date: Fri, 25 Jul 2025 14:15:01 +0200 Subject: [PATCH 1/4] Disable soname substitution --- easybuild/easyblocks/p/python.py | 37 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/easybuild/easyblocks/p/python.py b/easybuild/easyblocks/p/python.py index d0ef2d40f1f..bbb7c361897 100644 --- a/easybuild/easyblocks/p/python.py +++ b/easybuild/easyblocks/p/python.py @@ -50,7 +50,7 @@ from easybuild.tools.config import build_option, ERROR, EBPYTHONPREFIXES from easybuild.tools.modules import get_software_libdir, get_software_root, get_software_version from easybuild.tools.filetools import apply_regex_substitutions, change_dir, mkdir -from easybuild.tools.filetools import read_file, remove_dir, symlink, write_file +from easybuild.tools.filetools import read_file, remove_dir, symlink, write_file, open_file from easybuild.tools.run import run_shell_cmd from easybuild.tools.systemtools import get_shared_lib_ext from easybuild.tools.utilities import trace_msg @@ -366,24 +366,23 @@ def patch_step(self, *args, **kwargs): ctypes_util_py = os.path.join("Lib", "ctypes", "util.py") orig_gcc_so_name = None # Let's do this incrementally since we are going back in time - if LooseVersion(self.version) >= "3.9.1": - # From 3.9.1 to at least v3.12.4 there is only one match for this line - orig_gcc_so_name = "_get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name))" - if orig_gcc_so_name: - orig_gcc_so_name_regex = r'(\s*)' + re.escape(orig_gcc_so_name) + r'(\s*)' - # _get_soname() takes the full path as an argument and uses objdump to get the SONAME field from - # the shared object file. The presence or absence of the SONAME field in the ELF header of a shared - # library is influenced by how the library is compiled and linked. For manually built libraries we - # may be lacking this field, this approach also solves that problem. - updated_gcc_so_name = ( - "_findLib_gcc(name) or _findLib_ld(name)" - ) - apply_regex_substitutions( - ctypes_util_py, - [(orig_gcc_so_name_regex, r'\1' + updated_gcc_so_name + r'\2')], - on_missing_match=ERROR - ) - + #if LooseVersion(self.version) >= "3.9.1": + # # From 3.9.1 to at least v3.12.4 there is only one match for this line + # orig_gcc_so_name = "_get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name))" + #if orig_gcc_so_name: + # orig_gcc_so_name_regex = r'(\s*)' + re.escape(orig_gcc_so_name) + r'(\s*)' + # # _get_soname() takes the full path as an argument and uses objdump to get the SONAME field from + # # the shared object file. The presence or absence of the SONAME field in the ELF header of a shared + # # library is influenced by how the library is compiled and linked. For manually built libraries we + # # may be lacking this field, this approach also solves that problem. + # updated_gcc_so_name = ( + # "_findLib_gcc(name) or _findLib_ld(name)" + # ) + # apply_regex_substitutions( + # ctypes_util_py, + # [(orig_gcc_so_name_regex, r'\1' + updated_gcc_so_name + r'\2')], + # on_missing_match=ERROR + # ) # if we're installing Python with an alternate sysroot, # we need to patch setup.py which includes hardcoded paths like /usr/include and /lib64; # this fixes problems like not being able to build the _ssl module ("Could not build the ssl module") From 1e03933350967b35de64e83d32fbc04d6523958c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danilo=20Gonz=C3=A1lez?= Date: Fri, 25 Jul 2025 16:27:17 +0200 Subject: [PATCH 2/4] Update python.py --- easybuild/easyblocks/p/python.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/easybuild/easyblocks/p/python.py b/easybuild/easyblocks/p/python.py index bbb7c361897..4e318e6d39a 100644 --- a/easybuild/easyblocks/p/python.py +++ b/easybuild/easyblocks/p/python.py @@ -365,11 +365,12 @@ def patch_step(self, *args, **kwargs): if 'LD_LIBRARY_PATH' in filtered_env_vars and 'LIBRARY_PATH' not in filtered_env_vars: ctypes_util_py = os.path.join("Lib", "ctypes", "util.py") orig_gcc_so_name = None + # Let's do this incrementally since we are going back in time - #if LooseVersion(self.version) >= "3.9.1": + # if LooseVersion(self.version) >= "3.9.1": # # From 3.9.1 to at least v3.12.4 there is only one match for this line # orig_gcc_so_name = "_get_soname(_findLib_gcc(name)) or _get_soname(_findLib_ld(name))" - #if orig_gcc_so_name: + # if orig_gcc_so_name: # orig_gcc_so_name_regex = r'(\s*)' + re.escape(orig_gcc_so_name) + r'(\s*)' # # _get_soname() takes the full path as an argument and uses objdump to get the SONAME field from # # the shared object file. The presence or absence of the SONAME field in the ELF header of a shared From 197fb185604b09e04b56f3619f049b04733e2af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danilo=20Gonz=C3=A1lez?= Date: Fri, 25 Jul 2025 16:28:27 +0200 Subject: [PATCH 3/4] Update python.py --- easybuild/easyblocks/p/python.py | 1 - 1 file changed, 1 deletion(-) diff --git a/easybuild/easyblocks/p/python.py b/easybuild/easyblocks/p/python.py index 4e318e6d39a..a1a9ec28896 100644 --- a/easybuild/easyblocks/p/python.py +++ b/easybuild/easyblocks/p/python.py @@ -365,7 +365,6 @@ def patch_step(self, *args, **kwargs): if 'LD_LIBRARY_PATH' in filtered_env_vars and 'LIBRARY_PATH' not in filtered_env_vars: ctypes_util_py = os.path.join("Lib", "ctypes", "util.py") orig_gcc_so_name = None - # Let's do this incrementally since we are going back in time # if LooseVersion(self.version) >= "3.9.1": # # From 3.9.1 to at least v3.12.4 there is only one match for this line From 55298c13cd3f4fb1973d72ca01d006091957b191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danilo=20Gonz=C3=A1lez?= Date: Fri, 25 Jul 2025 16:30:05 +0200 Subject: [PATCH 4/4] remove not used import --- easybuild/easyblocks/p/python.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/easyblocks/p/python.py b/easybuild/easyblocks/p/python.py index a1a9ec28896..5a1d4af0e43 100644 --- a/easybuild/easyblocks/p/python.py +++ b/easybuild/easyblocks/p/python.py @@ -50,7 +50,7 @@ from easybuild.tools.config import build_option, ERROR, EBPYTHONPREFIXES from easybuild.tools.modules import get_software_libdir, get_software_root, get_software_version from easybuild.tools.filetools import apply_regex_substitutions, change_dir, mkdir -from easybuild.tools.filetools import read_file, remove_dir, symlink, write_file, open_file +from easybuild.tools.filetools import read_file, remove_dir, symlink, write_file from easybuild.tools.run import run_shell_cmd from easybuild.tools.systemtools import get_shared_lib_ext from easybuild.tools.utilities import trace_msg