Ensure egg modules path is absolute

Paths defined on sys.path may contain a relative path, so it must
be converted to absoulte path otherwise the starting comparison will
fail

issue6607
review39471002
This commit is contained in:
Sergi Almacellas Abellana committed 2017-07-03 18:13:27 +02:00
1 parent e3455875fb
commit 010043fbe0
1 file changed
+2
+2
View File
@@ -43,12 +43,14 @@ def file_open(name, mode="r", subdir='modules', encoding=None):
epoint = EGG_MODULES[module_name]
mod_path = os.path.join(epoint.dist.location,
*epoint.module_name.split('.')[:-1])
mod_path = os.path.abspath(mod_path)
egg_name = secure_join(mod_path, name)
if not os.path.isfile(egg_name):
# Find module in path
for path in sys.path:
mod_path = os.path.join(path,
*epoint.module_name.split('.')[:-1])
mod_path = os.path.abspath(mod_path)
egg_name = secure_join(mod_path, name)
if os.path.isfile(egg_name):
break