Commit e74ad055 authored by Stefan Behnel's avatar Stefan Behnel

Py3 install fix: keep original Py2 source modules of Cython alive during...

Py3 install fix: keep original Py2 source modules of Cython alive during installation when replacing them with 2to3-ed versions - we still need the build_ext stuff
parent e0494ef1
......@@ -106,12 +106,19 @@ def compile_cython_modules(profile=False):
)
class build_ext(build_ext_orig):
# we must keep the original modules alive to make sure
# their code keeps working when we remove them from
# sys.modules
dead_modules = []
def build_extensions(self):
# add path where 2to3 installed the transformed sources
# and make sure Python (re-)imports them from there
already_imported = [ module for module in sys.modules
if module == 'Cython' or module.startswith('Cython.') ]
keep_alive = self.dead_modules.append
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))
......
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