Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
fix: handle archive and counterexamples correctly when adding port co…
Browse files Browse the repository at this point in the history
…mments (#19237)
  • Loading branch information
eric-wieser committed Jul 16, 2023
1 parent 016138c commit 88e6ad4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/add_port_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
status = PortStatus.deserialize_old()

src_path = Path(__file__).parent.parent / 'src'
archive_path = Path(__file__).parent.parent / 'archive'
counterexamples_path = Path(__file__).parent.parent / 'counterexamples'

def make_comment(fstatus):
return textwrap.dedent(f"""\
Expand Down Expand Up @@ -87,6 +89,11 @@ def add_port_status(fcontent: str, fstatus: FileStatus) -> str:
return fcontent

def fname_for(import_path: str) -> Path:
for root in [src_path, archive_path, counterexamples_path]:
p = root / Path(*import_path.split('.')).with_suffix('.lean')
if p.exists():
return p
# used only for error messages, a best-guess
return src_path / Path(*import_path.split('.')).with_suffix('.lean')


Expand Down

0 comments on commit 88e6ad4

Please sign in to comment.