Skip to content

Commit fbf8ec0

Browse files
committed
Fix tasks.py
1 parent d3c3b65 commit fbf8ec0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tasks.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,14 @@ def publish(ctx: Context) -> None:
8989

9090
@task
9191
def set_ver(ctx: Context, version: str):
92-
with open("setup.py", encoding="utf-8") as file:
93-
contents = file.read()
94-
contents = re.sub(r"version=([^,]+),", f"version={version!r},", contents)
92+
with open("pyproject.toml") as file:
93+
lines = [re.sub(r"^version = \"([^,]+)\"", f'version = "{version}"', line.rstrip()) for line in file]
94+
95+
with open("pyproject.toml", "w") as file:
96+
file.write("\n".join(lines) + "\n")
9597

96-
with open("setup.py", mode="w", encoding="utf-8") as file:
97-
file.write(contents)
98+
ctx.run("ruff check --fix custodian")
99+
ctx.run("ruff format pyproject.toml")
98100

99101

100102
@task

0 commit comments

Comments
 (0)