Anki/pylib/tools/genbuildinfo.py
Abdo f94d05bcbe
Switch to Ruff (#4119)
* Add check:ruff build action

* Add fix:ruff action

* Add Ruff config

Mostly generated by Cursor

* Handle rest of lints

* Fix formatting

* Replace black and isort with ruff-format

* Run ruff-format

* Fix lint errors

* Remove pylint disables

* Remove .pylintrc

* Update docs

* Fix check:format not just checking

* Fix isort rule being ignored

* Sort imports

* Ensure ./ninja format also handles import sorting

* Remove unused isort cfg

* Enable unsafe fixes in fix:ruff, and enable unused var warning

* Re-run on config change; enable unnecessary ARG ignores

* Use all pycodestyle errors, and add some more commented-out ones

Latter logged on https://github.com/ankitects/anki/issues/4135
2025-06-29 14:38:35 +07:00

19 lines
587 B
Python

# Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import sys
version_file = sys.argv[1]
buildhash_file = sys.argv[2]
outpath = sys.argv[3]
with open(version_file, "r", encoding="utf8") as f:
version = f.read().strip()
with open(buildhash_file, "r", encoding="utf8") as f:
buildhash = f.read().strip()
with open(outpath, "w", encoding="utf8") as f:
# if we switch to uppercase we'll need to add legacy aliases
f.write(f"version = '{version}'\n")
f.write(f"buildhash = '{buildhash}'\n")