Commit daa79349 authored by Min RK's avatar Min RK

check for build_ext object in import check

When setuptools imports from Cython (Python 3.5),
setuptools.command.build_ext is defined,
but setuptools.command.build_ext has no attribute .build_ext, yet,
causing the `_build_ext.build_ext` to fail with an AttributeError.

By attempting to import the object, rather than its containing module, the check is more thorough.
parent b1d7b0de
...@@ -2,16 +2,16 @@ import sys ...@@ -2,16 +2,16 @@ import sys
if 'setuptools' in sys.modules: if 'setuptools' in sys.modules:
try: try:
from setuptools.command import build_ext as _build_ext from setuptools.command.build_ext import build_ext as _build_ext
except ImportError: except ImportError:
# We may be in the process of importing setuptools, which tries # We may be in the process of importing setuptools, which tries
# to import this. # to import this.
from distutils.command import build_ext as _build_ext from distutils.command.build_ext import build_ext as _build_ext
else: else:
from distutils.command import build_ext as _build_ext from distutils.command.build_ext import build_ext as _build_ext
class build_ext(_build_ext.build_ext, object): class build_ext(_build_ext, object):
def finalize_options(self): def finalize_options(self):
if self.distribution.ext_modules: if self.distribution.ext_modules:
from Cython.Build.Dependencies import cythonize from Cython.Build.Dependencies import cythonize
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment