diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2019-12-29 12:47:31 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2019-12-29 12:47:31 -0500 |
| commit | a5b66a8581b758aff763765857359ef540631202 (patch) | |
| tree | 9404571514fbe550c98a939bd4458d97e1bf1dd2 /setuptools/command/build_ext.py | |
| parent | d53e024af2f5d8f3a4a36588c3dc004d156bc830 (diff) | |
| parent | e6bdf25f6ab5bf4d32b0f9affa0ab98ea35f3a29 (diff) | |
| download | external_python_setuptools-a5b66a8581b758aff763765857359ef540631202.tar.gz external_python_setuptools-a5b66a8581b758aff763765857359ef540631202.tar.bz2 external_python_setuptools-a5b66a8581b758aff763765857359ef540631202.zip | |
Merge branch 'master' into feature/include-pyproject.toml
Diffstat (limited to 'setuptools/command/build_ext.py')
| -rw-r--r-- | setuptools/command/build_ext.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index 60a8a32f..daa8e4fe 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -1,7 +1,6 @@ import os import sys import itertools -import imp from distutils.command.build_ext import build_ext as _du_build_ext from distutils.file_util import copy_file from distutils.ccompiler import new_compiler @@ -12,6 +11,13 @@ from distutils import log from setuptools.extension import Library from setuptools.extern import six +if six.PY2: + import imp + + EXTENSION_SUFFIXES = [s for s, _, tp in imp.get_suffixes() if tp == imp.C_EXTENSION] +else: + from importlib.machinery import EXTENSION_SUFFIXES + try: # Attempt to use Cython for building extensions, if available from Cython.Distutils.build_ext import build_ext as _build_ext @@ -64,7 +70,7 @@ if_dl = lambda s: s if have_rtld else '' def get_abi3_suffix(): """Return the file extension for an abi3-compliant Extension()""" - for suffix, _, _ in (s for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION): + for suffix in EXTENSION_SUFFIXES: if '.abi3' in suffix: # Unix return suffix elif suffix == '.pyd': # Windows |
