Commit b792ef1c authored by Robert Bradshaw's avatar Robert Bradshaw

Merge pull request #175 from steinn/pyximport_fix

fix import of pyx modules when '' is in sys.path
parents c6f5ffd5 3d17fc9d
...@@ -291,17 +291,21 @@ class PyxImporter(object): ...@@ -291,17 +291,21 @@ class PyxImporter(object):
paths = sys.path paths = sys.path
join_path = os.path.join join_path = os.path.join
is_file = os.path.isfile is_file = os.path.isfile
is_abs = os.path.isabs
abspath = os.path.abspath
#is_dir = os.path.isdir #is_dir = os.path.isdir
sep = os.path.sep sep = os.path.sep
for path in paths: for path in paths:
if not path: if not path:
path = os.getcwd() path = os.getcwd()
elif not is_abs(path):
path = abspath(path)
if is_file(path+sep+pyx_module_name): if is_file(path+sep+pyx_module_name):
return PyxLoader(fullname, join_path(path, pyx_module_name), return PyxLoader(fullname, join_path(path, pyx_module_name),
pyxbuild_dir=self.pyxbuild_dir, pyxbuild_dir=self.pyxbuild_dir,
inplace=self.inplace, inplace=self.inplace,
language_level=self.language_level) language_level=self.language_level)
# not found, normal package, not a .pyx file, none of our business # not found, normal package, not a .pyx file, none of our business
_debug("%s not found" % fullname) _debug("%s not found" % fullname)
return None return None
......
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