Skip to content

Commit 8521478

Browse files
committed
build: remove write_text for 3.9 compat
1 parent ae20725 commit 8521478

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

build.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def codegen() -> str:
7373
if __name__ == "__main__":
7474
print("running codegen")
7575
palette_path = Path.cwd() / "catppuccin" / "palette.py"
76-
palette_path.write_text(codegen(), newline="\n")
76+
with palette_path.open("w", newline="\n") as f:
77+
f.write(codegen())
7778
print("formatting with ruff")
7879
ruff_format = f"ruff format {palette_path}"
7980
subprocess.run(ruff_format.split(), check=True, stdout=subprocess.DEVNULL)
@@ -97,7 +98,9 @@ def codegen() -> str:
9798
f"<{color}>",
9899
palette["colors"][color]["hex"].replace("#", ""),
99100
)
100-
(CATPPUCCIN_STYLE_DIRECTORY / f"{key}.mplstyle").write_text(text, newline="\n")
101+
style_path = CATPPUCCIN_STYLE_DIRECTORY / f"{key}.mplstyle"
102+
with style_path.open("w", newline="\n") as f:
103+
f.write(text)
101104
print("matplotlib styles generation complete")
102105

103106
# Generate matplotlib assets for the docs

0 commit comments

Comments
 (0)