Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions vyper/compiler/output_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from vyper.compiler.input_bundle import CompilerInput, JSONInput, _NotFound
from vyper.compiler.phases import CompilerData
from vyper.compiler.settings import Settings
from vyper.exceptions import CompilerPanic
from vyper.utils import get_long_version, safe_relpath

# data structures and routines for constructing "output bundles",
Expand Down Expand Up @@ -100,6 +99,9 @@
# preserve order of original search paths
tmp = {sp: 0 for sp in search_paths}

# whether all files are resolvable by search paths
well_formed = False

for c in self.source_codes.values():
ok = False
# recover the search path that was used for this CompilerInput.
Expand All @@ -115,15 +117,20 @@
tmp[sp] += 1
ok = True

# this shouldn't happen unless a file escapes its package,
# *or* if we have a bug
# this shouldn't happen unless a file escapes its package
if not ok:
raise CompilerPanic(f"Invalid path: {c.resolved_path}")
well_formed = False

Check warning on line 122 in vyper/compiler/output_bundle.py

View check run for this annotation

Codecov / codecov/patch

vyper/compiler/output_bundle.py#L122

Added line #L122 was not covered by tests

sps = [sp for sp, count in tmp.items() if count > 0]
assert len(sps) > 0

return [_anonymize(safe_relpath(sp)) for sp in sps]
sps = [_anonymize(safe_relpath(sp)) for sp in sps]

# there is some file which escapes its package, so add a "." to the
# search paths so it will resolve
if not well_formed and "." not in sps:
sps.append(".")

Check warning on line 131 in vyper/compiler/output_bundle.py

View check run for this annotation

Codecov / codecov/patch

vyper/compiler/output_bundle.py#L131

Added line #L131 was not covered by tests

return sps


class OutputBundleWriter:
Expand Down