Skip to content

Commit

Permalink
Merge pull request #1776 from consol3cowboy/master
Browse files Browse the repository at this point in the history
Search parent paths for import file during source verification
  • Loading branch information
iamdefinitelyahuman authored May 22, 2024
2 parents 32b5e34 + 5b3cad3 commit e24b9ad
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion brownie/project/flattener.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,11 @@ def make_import_absolute(import_path: str, source_file_dir: str) -> str:
if path.is_absolute():
return path.as_posix()

return (Path(source_file_dir) / path).resolve().as_posix()
source_file_dir = Path(source_file_dir).resolve()
newpath = (source_file_dir / path).resolve()
while not newpath.exists():
source_file_dir = source_file_dir.parent
newpath = (source_file_dir / path).resolve()
if source_file_dir == Path("/"):
raise FileNotFoundError(f"Cannot determine location of {import_path}")
return newpath.as_posix()

0 comments on commit e24b9ad

Please sign in to comment.