From cd313e36e46ade02ecad6ca180156af1a2426166 Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Mon, 23 Jun 2025 14:51:47 +0200 Subject: [PATCH 1/2] relax output bundle construction this always produces a valid input bundle. it doesn't guarantee that paths are always anonymized, but it guarantees that the output bundle is produced, rather than panicking (which is rather frustrating UX). --- vyper/compiler/output_bundle.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/vyper/compiler/output_bundle.py b/vyper/compiler/output_bundle.py index e962646a1f..25b3bd2f58 100644 --- a/vyper/compiler/output_bundle.py +++ b/vyper/compiler/output_bundle.py @@ -100,6 +100,9 @@ def used_search_paths(self) -> list[str]: # 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. @@ -115,15 +118,20 @@ def used_search_paths(self) -> list[str]: 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 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(".") + + return sps class OutputBundleWriter: From 431105d5cdeb04e2ac4d16d4115024f88947c322 Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Thu, 26 Jun 2025 16:22:02 +0200 Subject: [PATCH 2/2] lint --- vyper/compiler/output_bundle.py | 1 - 1 file changed, 1 deletion(-) diff --git a/vyper/compiler/output_bundle.py b/vyper/compiler/output_bundle.py index 25b3bd2f58..ec3d886d4a 100644 --- a/vyper/compiler/output_bundle.py +++ b/vyper/compiler/output_bundle.py @@ -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",