diff options
author | Steve Dower <steve.dower@microsoft.com> | 2021-07-09 22:45:51 +0100 |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2021-07-10 00:55:20 +0100 |
commit | 1eb36f2c1ee3bc42aa386291518bf62a97276155 (patch) | |
tree | c21423c2b84663bccbbf2bd3c0986568fa0712cf /setuptools/command/build_ext.py | |
parent | 4b64119ab29b1418dc4975ea4212ab38f112c2ab (diff) | |
download | python-setuptools-git-1eb36f2c1ee3bc42aa386291518bf62a97276155.tar.gz |
Fixes #2722: Adds an environment variable SETUPTOOLS_EXT_SUFFIX to override the suffix inferred from the host Python runtime.
Diffstat (limited to 'setuptools/command/build_ext.py')
-rw-r--r-- | setuptools/command/build_ext.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index 03a72b4f..c59eff8b 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -104,14 +104,20 @@ class build_ext(_build_ext): self.write_stub(package_dir or os.curdir, ext, True) def get_ext_filename(self, fullname): - filename = _build_ext.get_ext_filename(self, fullname) + so_ext = os.getenv('SETUPTOOLS_EXT_SUFFIX') + if so_ext: + filename = os.path.join(*fullname.split('.')) + so_ext + else: + filename = _build_ext.get_ext_filename(self, fullname) + so_ext = get_config_var('EXT_SUFFIX') + if fullname in self.ext_map: ext = self.ext_map[fullname] use_abi3 = getattr(ext, 'py_limited_api') and get_abi3_suffix() if use_abi3: - so_ext = get_config_var('EXT_SUFFIX') filename = filename[:-len(so_ext)] - filename = filename + get_abi3_suffix() + so_ext = get_abi3_suffix() + filename = filename + so_ext if isinstance(ext, Library): fn, ext = os.path.splitext(filename) return self.shlib_compiler.library_filename(fn, libtype) |