Don't mess with the path if the import is absolute

This commit is contained in:
Laurens Van Houtven
2013-06-23 22:00:23 +02:00
parent e82e3eaa0d
commit 7eff1bbf06

View File

@@ -91,6 +91,11 @@ class ImportPath(pr.Base):
and len(self.import_stmt.namespace.names) > 1 \
and not self.direct_resolve
@property
def is_absolute(self):
module = self.import_stmt.get_parent_until(pr.IsScope)
return module.absolute_imports
def get_nested_import(self, parent):
"""
See documentation of `self.is_nested_import`.
@@ -252,7 +257,7 @@ class ImportPath(pr.Base):
return importing
if self.file_path:
if self.file_path and not self.is_absolute:
sys_path_mod = list(self.sys_path_with_modifications())
sys_path_mod.insert(0, self.file_path)
else: