summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index ed3a72fb0..12592c536 100755
--- a/setup.py
+++ b/setup.py
@@ -190,7 +190,9 @@ def _defer_cython_import_in_py32(build_ext_orig, source_root, profile=False):
# sys.modules
dead_modules = []
- def build_extensions(self):
+ def __reimport(self):
+ if self.dead_modules:
+ return
# add path where 2to3 installed the transformed sources
# and make sure Python (re-)imports them from there
already_imported = [
@@ -203,6 +205,12 @@ def _defer_cython_import_in_py32(build_ext_orig, source_root, profile=False):
del sys.modules[module]
sys.path.insert(0, os.path.join(source_root, self.build_lib))
+ def finalize_options(self):
+ self.__reimport()
+ super(build_ext, self).finalize_options()
+
+ def build_extensions(self):
+ self.__reimport()
if profile:
from Cython.Compiler.Options import directive_defaults
directive_defaults['profile'] = True