Commit cb0dca06 authored by Stefan Behnel's avatar Stefan Behnel

Import Cython in "build_ext" only if it's actually needed, i.e. if any Cython...

Import Cython in "build_ext" only if it's actually needed, i.e. if any Cython implemented extension modules were found.
parent 84977382
......@@ -201,17 +201,6 @@ class old_build_ext(_build_ext.build_ext):
found, and return a modified 'sources' list with Cython source
files replaced by the generated C (or C++) files.
"""
try:
from Cython.Compiler.Main \
import CompilationOptions, \
default_options as cython_default_options, \
compile as cython_compile
from Cython.Compiler.Errors import PyrexError
except ImportError:
e = sys.exc_info()[1]
print("failed to import Cython: %s" % e)
raise DistutilsPlatformError("Cython does not appear to be installed")
new_sources = []
cython_sources = []
cython_targets = {}
......@@ -313,6 +302,17 @@ class old_build_ext(_build_ext.build_ext):
if not cython_sources:
return new_sources
try:
from Cython.Compiler.Main \
import CompilationOptions, \
default_options as cython_default_options, \
compile as cython_compile
from Cython.Compiler.Errors import PyrexError
except ImportError:
e = sys.exc_info()[1]
print("failed to import Cython: %s" % e)
raise DistutilsPlatformError("Cython does not appear to be installed")
module_name = extension.name
for source in cython_sources:
......
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