The import resolution for namespace packages was wrong
With this change we can now include all parents of the script, which will make relative imports always work. Now the whole meta_path is scanned and not just importlib's PathFinder. Fixes #1183.
This commit is contained in:
1 parent
ad5170a37a
commit
4b276bae87
6 files changed
+56
-22
No files matched your search
+1
-6
@@ -108,12 +108,7 @@ class Project(object):
|
||||
if evaluator.script_path is not None:
|
||||
suffixed += discover_buildout_paths(evaluator, evaluator.script_path)
|
||||
|
||||
traversed = []
|
||||
for parent in traverse_parents(evaluator.script_path):
|
||||
traversed.append(parent)
|
||||
if parent == self._path:
|
||||
# Don't go futher than the project path.
|
||||
break
|
||||
traversed = list(traverse_parents(evaluator.script_path))
|
||||
|
||||
# AFAIK some libraries have imports like `foo.foo.bar`, which
|
||||
# leads to the conclusion to by default prefer longer paths
|
||||
|
||||
Reference in new issue
Block a user