Skip to content

Commit

Permalink
Simplify release script
Browse files Browse the repository at this point in the history
  • Loading branch information
alex authored Oct 9, 2023
1 parent 27c6251 commit d2ed190
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions release.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ def release(version: str) -> None:
def replace_version(
p: pathlib.Path, variable_name: str, new_version: str
) -> None:
with p.open() as f:
content = f.read()
content = p.read_text()

pattern = rf"^{variable_name}\s*=\s*.*$"
match = re.search(pattern, content, re.MULTILINE)
Expand All @@ -56,9 +55,7 @@ def replace_version(
content[:start] + f'{variable_name} = "{new_version}"' + content[end:]
)

# Write back to file
with p.open("w") as f:
f.write(new_content)
p.write_text(new_content)


@cli.command()
Expand Down

0 comments on commit d2ed190

Please sign in to comment.