Commit ffab2182 authored by Robert Bradshaw's avatar Robert Bradshaw

More efficient find_root_package_dir.

parent 9df4e4e1
...@@ -117,11 +117,11 @@ def search_include_directories(dirs, qualified_name, suffix, pos, ...@@ -117,11 +117,11 @@ def search_include_directories(dirs, qualified_name, suffix, pos,
@cached_function @cached_function
def find_root_package_dir(file_path): def find_root_package_dir(file_path):
dir = os.path.dirname(file_path) dir = os.path.dirname(file_path)
while is_package_dir(dir): if file_path == dir:
parent = os.path.dirname(dir) return dir
if parent == dir: elif is_package_dir(dir):
break return find_root_package_dir(dir)
dir = parent else:
return dir return dir
@cached_function @cached_function
......
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