From 04fd9ed7f6d5d8754a81af93f6276a8495f937c5 Mon Sep 17 00:00:00 2001 From: Stefan Allius <122395479+s-allius@users.noreply.github.com> Date: Sat, 21 Jun 2025 10:26:17 +0200 Subject: [PATCH] S allius/issue460 (#461) * - Improve Makefile * - Babel don't build new po file if only the pot creation-date was changed --- CHANGELOG.md | 2 ++ Makefile | 30 ++++++++++++++++++++---------- app/Makefile | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85c6931..64b02ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +- Babel don't build new po file if only the pot creation-date was changed +- Improve Makefile - Update dependency pytest-asyncio to v1 ## [0.14.1] - 2025-05-31 diff --git a/Makefile b/Makefile index 5964e6e..394ac69 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,37 @@ -.PHONY: build babel clean addon-dev addon-debug addon-rc addon-rel debug dev preview rc rel check-docker-compose install +.PHONY: help build babel clean addon-dev addon-debug addon-rc addon-rel debug dev preview rc rel check-docker-compose install -babel: +help: ## show help message + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[$$()% a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + +babel: ## build language files $(MAKE) -C app $@ build: $(MAKE) -C ha_addons $@ -clean: +clean: ## delete all built files $(MAKE) -C app $@ $(MAKE) -C ha_addons $@ -debug dev preview rc rel: +debug dev preview rc rel: ## build docker container in version $(MAKE) -C app babel $(MAKE) -C app $@ -addon-dev addon-debug addon-rc addon-rel: +addon-dev addon-debug addon-rc addon-rel: ## build HA add-on in version $(MAKE) -C app babel $(MAKE) -C ha_addons $(patsubst addon-%,%,$@) -check-docker-compose: +check-docker-compose: ## check the docker-compose file docker-compose config -q -install: - python3 -m pip install --upgrade pip - python3 -m pip install -r requirements.txt - python3 -m pip install -r requirements-test.txt \ No newline at end of file +PY_VER := $(shell cat .python-version) + +install: ## install requirements into the pyenv and switch to proper venv + @pyenv local $(PY_VER) || { pyenv install $(PY_VER) && pyenv local $(PY_VER) || exit 1; } + @pyenv exec pip install --upgrade pip + @pyenv exec pip install -r requirements.txt + @pyenv exec pip install -r requirements-test.txt + pyenv exec python --version + +run: ## run proxy locally out of the actual venv + pyenv exec python app/src/server.py -c /app/src/cnf \ No newline at end of file diff --git a/app/Makefile b/app/Makefile index 29be248..c192556 100644 --- a/app/Makefile +++ b/app/Makefile @@ -55,7 +55,7 @@ $(BABEL_TRANSLATIONS)/%.pot : $(SRC)/.babel.cfg $(BABEL_INPUT) $(BABEL_TRANSLATIONS)/%/LC_MESSAGES/messages.po : $(BABEL_TRANSLATIONS)/messages.pot @mkdir -p $(@D) - @pybabel update --init-missing -i $< -d $(BABEL_TRANSLATIONS) -l $* + @pybabel update --init-missing --ignore-pot-creation-date -i $< -d $(BABEL_TRANSLATIONS) -l $* $(BABEL_TRANSLATIONS)/%/LC_MESSAGES/messages.mo : $(BABEL_TRANSLATIONS)/%/LC_MESSAGES/messages.po @pybabel compile -d $(BABEL_TRANSLATIONS) -l $*