Commit 6ded60ab authored by Stefan Behnel's avatar Stefan Behnel

prevent Py3.x build from picking up outdated sources from a previous 2to3 run

parent 1ca9b8dc
...@@ -175,15 +175,18 @@ def compile_cython_modules(profile=False, compile_more=False, cython_with_refnan ...@@ -175,15 +175,18 @@ def compile_cython_modules(profile=False, compile_more=False, cython_with_refnan
dead_modules = [] dead_modules = []
def build_extensions(self): def build_extensions(self):
# add path where 2to3 installed the transformed sources if sys.version_info[:2] == (3, 2):
# and make sure Python (re-)imports them from there # add path where 2to3 installed the transformed sources
already_imported = [ module for module in sys.modules # and make sure Python (re-)imports them from there
if module == 'Cython' or module.startswith('Cython.') ] already_imported = [
keep_alive = self.dead_modules.append module for module in sys.modules
for module in already_imported: if module == 'Cython' or module.startswith('Cython.')
keep_alive(sys.modules[module]) ]
del sys.modules[module] keep_alive = self.dead_modules.append
sys.path.insert(0, os.path.join(source_root, self.build_lib)) for module in already_imported:
keep_alive(sys.modules[module])
del sys.modules[module]
sys.path.insert(0, os.path.join(source_root, self.build_lib))
if profile: if profile:
from Cython.Compiler.Options import directive_defaults from Cython.Compiler.Options import directive_defaults
......
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