Commit 447bf748 authored by Igor Kaplounenko's avatar Igor Kaplounenko

pyimport=True should work now on darwin without having to pre-import distutils...

pyimport=True should work now on darwin without having to pre-import distutils directly or via pyxbuild
parent cd2a42e2
...@@ -351,6 +351,9 @@ class PyImporter(PyxImporter): ...@@ -351,6 +351,9 @@ class PyImporter(PyxImporter):
self.uncompilable_modules = {} self.uncompilable_modules = {}
self.blocked_modules = ['Cython', 'pyxbuild', 'pyximport.pyxbuild', self.blocked_modules = ['Cython', 'pyxbuild', 'pyximport.pyxbuild',
'distutils.extension', 'distutils.sysconfig'] 'distutils.extension', 'distutils.sysconfig']
# on OS X, distutils appears to shadow distutils.sysconfig
if os.name is 'posix' and os.uname()[0].lower().startswith('darwin'):
self.blocked_modules.append('distutils')
def find_module(self, fullname, package_path=None): def find_module(self, fullname, package_path=None):
if fullname in sys.modules: if fullname in sys.modules:
......
PYTHON -c "import pyimport_test; pyimport_test.test()"
######## pyimport_test.py ########
import os.path
import pyximport
pyximport.install(pyximport=False, pyimport=True,
build_dir=os.path.join(os.path.dirname(__file__), "TEST_TMP"))
def test():
import mymodule
assert mymodule.test_string == "TEST"
assert not mymodule.__file__.rstrip('oc').endswith('.py'), mymodule.__file__
######## mymodule.py ########
test_string = "TEST"
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