drop makefile
This commit is contained in:
@@ -1,49 +0,0 @@
|
|||||||
.PHONY: all client server cli test clean docs docs-clean i18n-extract i18n-init i18n-update i18n-compile
|
|
||||||
|
|
||||||
# CLI localization (nexus-cli strings only; daemon/server logs stay in English).
|
|
||||||
LOCALE_DIR := src/nexus_sync/locale
|
|
||||||
POT := $(LOCALE_DIR)/nexus.pot
|
|
||||||
LANG ?= ru
|
|
||||||
# PyInstaller --add-data separator is ':' on Unix, ';' on Windows.
|
|
||||||
LOCALE_DATA := $(LOCALE_DIR):nexus_sync/locale
|
|
||||||
|
|
||||||
all: client server cli
|
|
||||||
|
|
||||||
client:
|
|
||||||
pyinstaller --onefile src/nexus_sync/client/__main__.py --name nexus-sync-client
|
|
||||||
|
|
||||||
server:
|
|
||||||
pyinstaller --onefile src/nexus_sync/server/__main__.py --name nexus-sync-server
|
|
||||||
|
|
||||||
cli: i18n-compile
|
|
||||||
pyinstaller --onefile src/nexus_sync/cli/__main__.py --name nexus-cli \
|
|
||||||
--add-data "$(LOCALE_DATA)"
|
|
||||||
|
|
||||||
# Rebuild the message template from strings wrapped in _()/gettext()/ngettext().
|
|
||||||
i18n-extract:
|
|
||||||
pybabel extract -F babel.cfg -k _ -o $(POT) src
|
|
||||||
|
|
||||||
# Create a catalog for a new language, e.g. `make i18n-init LANG=de`.
|
|
||||||
i18n-init: i18n-extract
|
|
||||||
pybabel init -i $(POT) -d $(LOCALE_DIR) -D nexus -l $(LANG)
|
|
||||||
|
|
||||||
# Merge new/changed strings into existing catalogs.
|
|
||||||
i18n-update: i18n-extract
|
|
||||||
pybabel update -i $(POT) -d $(LOCALE_DIR) -D nexus
|
|
||||||
|
|
||||||
# Compile .po catalogs to the .mo files bundled with nexus-cli.
|
|
||||||
i18n-compile:
|
|
||||||
pybabel compile -d $(LOCALE_DIR) -D nexus
|
|
||||||
|
|
||||||
test:
|
|
||||||
pytest
|
|
||||||
|
|
||||||
# Build the Sphinx HTML documentation into docs/_build/html.
|
|
||||||
docs:
|
|
||||||
sphinx-build -b html docs docs/_build/html
|
|
||||||
|
|
||||||
docs-clean:
|
|
||||||
rm -rf docs/_build
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf build dist *.spec docs/_build
|
|
||||||
@@ -130,11 +130,8 @@ pip install -e .[docs]
|
|||||||
doit docs # output in docs/_build/html
|
doit docs # output in docs/_build/html
|
||||||
```
|
```
|
||||||
|
|
||||||
PyInstaller standalone binaries are also available through Makefile targets:
|
Individual standalone binaries: `doit pyinstaller_client`,
|
||||||
|
`doit pyinstaller_server`, `doit pyinstaller_cli`.
|
||||||
```
|
|
||||||
make [client|server|cli]
|
|
||||||
```
|
|
||||||
|
|
||||||
## systemd templates
|
## systemd templates
|
||||||
|
|
||||||
|
|||||||
+7
-6
@@ -78,19 +78,20 @@ Translation sources live in `src/nexus_sync/locale/<lang>/LC_MESSAGES/nexus.po`.
|
|||||||
Workflow (requires `pip install -e ".[dev]"`):
|
Workflow (requires `pip install -e ".[dev]"`):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make i18n-extract # rebuild the .pot template from _()-wrapped strings
|
doit i18n_extract # rebuild the .pot template from _()-wrapped strings
|
||||||
make i18n-update # merge new/changed strings into existing catalogs
|
doit i18n_update # merge new/changed strings into existing catalogs
|
||||||
make i18n-init LANG=de # start a new language
|
doit i18n_init --lang de # start a new language
|
||||||
# edit the .po file, then:
|
# edit the .po file, then:
|
||||||
make i18n-compile # build the .mo files shipped with the binary
|
doit i18n_compile # build the .mo files shipped with the binary
|
||||||
```
|
```
|
||||||
|
|
||||||
`make cli` compiles catalogs automatically and bundles them into the binary.
|
`doit pyinstaller_cli` compiles catalogs automatically and bundles them into the
|
||||||
|
binary.
|
||||||
|
|
||||||
## Build standalone binary
|
## Build standalone binary
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make cli
|
doit pyinstaller_cli
|
||||||
```
|
```
|
||||||
|
|
||||||
This creates `dist/nexus-cli` through PyInstaller (with localization catalogs
|
This creates `dist/nexus-cli` through PyInstaller (with localization catalogs
|
||||||
|
|||||||
@@ -63,6 +63,16 @@ def task_i18n_extract():
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def task_i18n_init():
|
||||||
|
"""Create a catalog for a new language, e.g. `doit i18n_init --lang de`."""
|
||||||
|
return {
|
||||||
|
"actions": [f"{PYBABEL} init -i {POT_FILE} -d {LOCALE_DIR} -D nexus -l %(lang)s"],
|
||||||
|
"params": [{"name": "lang", "short": "l", "long": "lang", "default": "ru"}],
|
||||||
|
"file_dep": [str(POT_FILE)],
|
||||||
|
"verbosity": 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def task_i18n_update():
|
def task_i18n_update():
|
||||||
"""Merge new/changed strings from the template into existing catalogs."""
|
"""Merge new/changed strings from the template into existing catalogs."""
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user