chore: build system

This commit is contained in:
yzqzss 2023-08-17 04:29:14 +08:00
parent 36127765e4
commit 7bd3a4581d
4 changed files with 14 additions and 16 deletions

View File

@ -31,6 +31,9 @@ jobs:
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
poetry install
pip install -e .
- name: build
run: |
python build.py
- name: Lint with ruff
uses: chartboost/ruff-action@v1
with:

View File

@ -2,6 +2,7 @@ import gettext
import locale
default_lang, default_enc = locale.getdefaultlocale()
default_lang = default_lang or "en"
languages = ["en"] if not default_lang.lower().startswith("zh") else ["zh_CN"]

8
build.py Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env python3
import subprocess
if __name__ == "__main__":
print("Building i18n...")
subprocess.run(["msgfmt", "biliarchiver/locales/en/LC_MESSAGES/biliarchiver.po", "-o", "biliarchiver/locales/en/LC_MESSAGES/biliarchiver.mo"])
print("Building with poetry...")
subprocess.run(["poetry", "build"])

View File

@ -5,6 +5,7 @@ description = ""
authors = ["yzqzss <yzqzss@yandex.com>"]
readme = "README.md"
packages = [{ include = "biliarchiver" }]
include = ["biliarchiver/locales/**/*.mo"]
[tool.poetry.dependencies]
python = "^3.9"
@ -35,22 +36,7 @@ fixable = ["ALL"]
unfixable = []
# Exclude a variety of commonly ignored directories.
exclude = [
".direnv",
".git",
".git-rewrite",
".pants.d",
".pytype",
".ruff_cache",
".js",
".venv",
"__pypackages__",
"_build",
"build",
"dist",
"node_modules",
"venv",
]
exclude = []
per-file-ignores = {}
# Same as Black.