summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteinn Steinsen <steinnsteinsen@gmail.com>2013-01-16 10:38:47 +0000
committerSteinn Steinsen <steinnsteinsen@gmail.com>2013-01-16 10:38:47 +0000
commit9179ad4ca0c6d25893891d6bf690fbbd7b7f63cd (patch)
treef8ff2397a58488cabc8a4011fcc3d08351e0f86c
parent16bb65dc7f913e8fe162ddd1d27778e5d1f3274a (diff)
downloadcython-9179ad4ca0c6d25893891d6bf690fbbd7b7f63cd.tar.gz
fix import of pyx modules when '' is in sys.path
If '' is in sys.path and a module is found the package_path is relative and breaks the build process. --HG-- extra : transplant_source : 9%EA%CC%A6%3D%1B9R%EF%0DmM%CFZ%18%F3%EC%06%3B%B7
-rw-r--r--pyximport/pyximport.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pyximport/pyximport.py b/pyximport/pyximport.py
index 9a991b6f2..911aeafb3 100644
--- a/pyximport/pyximport.py
+++ b/pyximport/pyximport.py
@@ -291,17 +291,21 @@ class PyxImporter(object):
paths = sys.path
join_path = os.path.join
is_file = os.path.isfile
+ is_abs = os.path.isabs
+ abspath = os.path.abspath
#is_dir = os.path.isdir
sep = os.path.sep
for path in paths:
if not path:
path = os.getcwd()
+ elif not is_abs(path):
+ path = abspath(path)
if is_file(path+sep+pyx_module_name):
return PyxLoader(fullname, join_path(path, pyx_module_name),
pyxbuild_dir=self.pyxbuild_dir,
inplace=self.inplace,
language_level=self.language_level)
-
+
# not found, normal package, not a .pyx file, none of our business
_debug("%s not found" % fullname)
return None