diff --git a/Lib/rebuildpython.py b/Lib/rebuildpython.py index 680ca0caf5fcdd..0500649464b00d 100644 --- a/Lib/rebuildpython.py +++ b/Lib/rebuildpython.py @@ -4,6 +4,7 @@ import ctypes import distutils import distutils.ccompiler +from importlib import machinery import fnmatch import json import os @@ -131,7 +132,12 @@ def run_rebuild(): if platform.system() != "Windows" and filename.startswith("lib"): filename = filename[3:] if filename.endswith(".a"): - filename = filename[:-2] + if platform.system() == "Linux": + ext_suffixes = machinery.all_suffixes() + linux_ext_suffix = ext_suffixes[2][:-3] + filename = filename.split(linux_ext_suffix)[0] + else: + filename = filename[:-2] if filename.endswith(".lib"): filename = filename[:-4] if ext_suffix and filename.endswith(ext_suffix):