erplibre/Makefile
Mathieu Benoit 4734c682a9 [FIX] format : trouver les addons et leur appliquer la norme OCA
Les six cibles d'addons visaient « ./addons/<dépôt>/ », une disposition que
seul un manifeste produit : la production les range sous
« odoo<version>/addons/ ». isort s'arrêtait donc sur une trace pour un chemin
inexistant, et « make format_all » échouait sans avoir formaté un module. Les
dépôts sont maintenant NOMMÉS, cherchés sous les deux dispositions, et celui
qu'un manifeste ne rapatrie pas s'annonce puis est ignoré. Le formateur est
celui de la communauté, qui a quitté black : ruff en 88 colonnes, avec les
sections d'imports « odoo » et « odoo.addons » qu'isort ne sait pas produire.
Vérifié : trois des six dépôts sont présents ici, les autres s'annoncent
absents sans faire échouer la cible.

--- EN ---

The six addons targets aimed at "./addons/<repo>/", a layout only one manifest
produces: production files them under "odoo<version>/addons/". isort therefore
stopped on a traceback for a non-existent path, and "make format_all" failed
without formatting a module. Repositories are now NAMED, looked up under both
layouts, and one a manifest does not check out announces itself then is
skipped. The formatter is the community's, which left black: ruff at 88
columns, with the "odoo" and "odoo.addons" import sections isort cannot
produce.
Checked: three of the six repositories are present here, the others announce
themselves absent without failing the target.

Assisted-by: Claude Opus 5
2026-09-24 13:56:57 -04:00

412 lines
12 KiB
Makefile

# bash, où qu'il soit. « /bin/bash » n'existe pas sur NixOS, où le shell
# vit dans le store : make s'y arrêtait sur « /bin/bash: No such file or
# directory » avant d'exécuter la moindre recette, y compris celle qui
# installe de quoi le créer. Le repli garde le chemin des plateformes qui
# l'ont, et l'affectation reste immédiate — SHELL est lu à chaque recette.
SHELL := $(shell command -v bash 2>/dev/null || echo /bin/bash)
ERPLIBRE_VERSION := $(strip \
$(if $(wildcard .erplibre-version),$(shell cat .erplibre-version),) \
)
ODOO_VERSION := $(strip \
$(if $(wildcard .odoo-version),$(shell cat .odoo-version),) \
)
LOG_FILE := ./.venv.$(ERPLIBRE_VERSION)/make_test.log
#############
# General #
#############
# ALL
.PHONY: all
all: todo
###############
# Detect OS #
###############
# https://stackoverflow.com/questions/714100/os-detecting-makefile
DETECTED_OS := $(shell uname -s)
############################
# Detect browser command #
############################
#BROWSER := ls
ifeq ($(DETECTED_OS),Darwin)
BROWSER := open
else
ifeq ($(DETECTED_OS),Linux)
BROWSER := xdg-open
else
ifeq ($(OS),Windows_NT)
BROWSER := start
else
BROWSER := ls
endif
endif
endif
# Include all Makefile
-include ./conf/make.code_generator.Makefile
-include ./conf/make.robotlibre.Makefile
-include ./conf/make.erplibre.Makefile
-include ./conf/make.database.Makefile
-include ./conf/make.docker.Makefile
-include ./conf/make.documentation.Makefile
-include ./conf/make.image_db.Makefile
-include ./conf/make.installation.Makefile
-include ./conf/make.installation.poetry.Makefile
-include ./conf/make.test.Makefile
-include ./conf/make.ssh.Makefile
-include ./conf/make.todo.Makefile
# Include private Makefile
-include ./private/make.private.Makefile
# Example for update
.PHONY: custom_run_example
custom_run_example:
./run.sh -d example_prod
.PHONY: custom_update_example
custom_update_example:
./script/database/db_restore.py --database example_prod --image image_name_to_restore
./script/addons/update_addons_all.sh example_prod
./script/addons/update_prod_to_dev.sh example_prod
#########
# RUN #
#########
.PHONY: run
run:
echo http://localhost:8069
echo http://localhost:8069/web/database/manager
./run.sh
.PHONY: run_test
run_test:
echo http://localhost:8069
./run.sh --database test
.PHONY: run_prod_client
run_prod_client:
echo http://localhost:8069
./run.sh --database prod_client
############
# VERSION #
############
.PHONY: version
version:
./script/version/update_env_version.py
###################
# Environnement #
###################
.PHONY: pyenv_update
pyenv_update:
~/.pyenv/bin/pyenv update
# mise pose un CPython PRECOMPILE la ou pyenv le compile : quelques secondes
# contre une a trois minutes, et aucun paquet -dev requis. Volontairement
# EXPLICITE : « curl | sh » engage, et ce n'est pas a un script d'installation
# de le decider a la place de l'utilisateur. Une fois mise present,
# EL_PYTHON_PROVIDER=auto s'en sert tout seul.
#
# Pas de binaire s390x publie a ce jour : sur cette architecture, la cible
# le dit et n'installe rien.
# uv installe les paquets Python nettement plus vite que pip, et met en cache
# les roues qu'il CONSTRUIT — ce qui compte la ou rien n'a de roue publiee.
# Contrairement a mise, uv publie une roue s390x : un « pip install uv » dans
# le venv d'outils suffit, sans « curl | sh ». Reste EXPLICITE quand meme,
# comme install_mise : EL_PIP_PROVIDER=auto s'en sert des qu'il est la.
#
# Attention a l'attente : « poetry install », qui domine le temps
# d'installation, n'est PAS accelere — uv ne lit pas poetry.lock.
.PHONY: install_uv
install_uv:
@if command -v uv >/dev/null 2>&1; then \
echo "uv deja present : $$(uv --version)"; \
else \
echo "Installation de uv dans le venv d outils"; \
./$$(cat conf/python-erplibre-venv | xargs)/bin/pip install uv; \
echo "uv : ./$$(cat conf/python-erplibre-venv | xargs)/bin/uv"; \
echo "Ajoutez ce repertoire au PATH, ou installez uv globalement."; \
fi
# Telecharge puis execute : dans « curl | sh », le statut est celui de sh,
# qui rend 0 sur une entree vide et masque un telechargement rate.
.PHONY: install_mise
install_mise:
@if command -v mise >/dev/null 2>&1; then \
echo "mise deja present : $$(mise --version)"; \
elif command -v pacman >/dev/null 2>&1; then \
sudo pacman -S --needed --noconfirm mise; \
elif [ "$$(uname -m)" = "s390x" ]; then \
echo "mise ne publie pas de binaire s390x : on reste sur pyenv."; \
else \
echo "Installation de mise depuis https://mise.run"; \
installateur="$$(mktemp)" || exit 1; \
if ! curl -fsSL -o "$$installateur" https://mise.run; then \
rm -f "$$installateur"; \
echo "Telechargement de l installateur mise impossible" \
"(reseau ou cache) : mise n est pas pose." >&2; \
exit 1; \
fi; \
if ! sh "$$installateur"; then \
rm -f "$$installateur"; \
echo "L installateur de mise a echoue (voir ci-dessus)." >&2; \
exit 1; \
fi; \
rm -f "$$installateur"; \
echo "Ajoutez ~/.local/bin a votre PATH, puis relancez l installation."; \
fi
.PHONY: db_create_db_test
db_create_db_test:
./script/make.sh db_drop_db_test
./odoo_bin.sh db --create --database test
.PHONY: db_clone_test_to_test2
db_clone_test_to_test2:
./odoo_bin.sh db --drop --database test2
./odoo_bin.sh db --clone --database test2 --from_database test
.PHONY: db_test_export
db_test_export:
./script/database/db_restore.py --database test_website_export
./script/addons/install_addons_dev.sh test_website_export demo_website_data
#########
# tag #
#########
.PHONY: tag_push_all
tag_push_all:
./script/git/tag_push_all.py
##############
# terminal #
##############
.PHONY: open_terminal
open_terminal:
./script/open_terminal_code_generator.sh
##############
# selenium #
##############
.PHONY: open_selenium
open_selenium:
./.venv.erplibre/bin/python ./script/selenium/web_login.py
############
# format #
############
.PHONY: format
format:
./script/maintenance/format_file_to_commit.py
.PHONY: format_all
format_all:
parallel ::: "./script/make.sh format_code_generator" "./script/make.sh format_code_generator_template" "./script/make.sh format_script" "./script/make.sh format_test" "./script/make.sh format_erplibre_addons" "./script/make.sh format_supported_addons"
# Les dépôts d'addons sont nommés, jamais leur chemin : il dépend du manifeste,
# et chaque version d'Odoo n'en rapatrie qu'une partie. Voir format_addons.sh.
.PHONY: format_code_generator
format_code_generator:
./script/maintenance/format_addons.sh --xml TechnoLibre_odoo-code-generator
.PHONY: format_erplibre_addons
format_erplibre_addons:
./script/maintenance/format_addons.sh --xml ERPLibre_erplibre_addons
./script/maintenance/format_addons.sh ERPLibre_erplibre_theme_addons
.PHONY: format_supported_addons
format_supported_addons:
./script/maintenance/format_addons.sh MathBenTech_erplibre-family-management \
MathBenTech_odoo-business-spending-management-quebec-canada
.PHONY: format_code_generator_template
format_code_generator_template:
./script/maintenance/format_addons.sh TechnoLibre_odoo-code-generator-template
# L'outillage passe par ruff, réglé une fois dans .ruff.toml, qui écarte les
# dépôts rapatriés sous script/. Les addons gardent black : voir
# script/maintenance/format_python.sh.
.PHONY: format_script
format_script:
.venv.erplibre/bin/ruff check --select I --fix ./script/
.venv.erplibre/bin/ruff format ./script/
# Les tests suivent la norme de l'outillage : ils tournent dans le même venv,
# et rien ne les formatait — seul « make format » les touchait, et seulement
# s'ils étaient modifiés.
.PHONY: format_test
format_test:
.venv.erplibre/bin/ruff check --select I --fix ./test/ ./long_test/
.venv.erplibre/bin/ruff format ./test/ ./long_test/
.PHONY: format_script_isort_only
format_script_isort_only:
.venv.erplibre/bin/ruff check --select I --fix ./script/
#########
# log #
#########
.PHONY: log_show_test
log_show_test:
vim ${LOG_FILE}
###########
# clean #
###########
.PHONY: clean_code_generator_template
clean_code_generator_template:
./script/git/repo_revert_git_diff_date_from_code_generator.py
.PHONY: clean_test
clean_test:
cd addons/OCA_server-tools; git stash; git clean -fd
##############
# Git repo #
##############
# clear all repo DANGER
.PHONY: repo_clear_all
repo_clear_all:
./script/git/clean_repo_manifest.sh
# configure all repo
.PHONY: repo_configure_all
repo_configure_all:
./script/manifest/update_manifest_local_dev.sh
# configure only group code_generator
.PHONY: repo_configure_group_code_generator
repo_configure_group_code_generator:
./script/manifest/update_manifest_local_dev_code_generator.sh
# Show git status for all repo
.PHONY: repo_show_status
repo_show_status:
.venv.erplibre/bin/repo forall -pc "git status -s"
# Show git stash for all repo
.PHONY: repo_do_stash
repo_do_stash:
.venv.erplibre/bin/repo forall -pc "git stash"
# Show divergence between actual repository and production manifest
.PHONY: repo_diff_manifest_production
repo_diff_manifest_production:
./script/git/git_show_code_diff_repo_manifest.py
# Show git diff for all repo from last tag version release
.PHONY: repo_diff_from_last_version
repo_diff_from_last_version:
./script/git/repo_diff_last_version.sh
# Show git diff statistique for all repo from last tag version release
.PHONY: repo_diff_stat_from_last_version
repo_diff_stat_from_last_version:
./script/git/repo_diff_stat_last_version.sh
# change all repo to ssh on all remote
.PHONY: repo_use_all_ssh
repo_use_all_ssh:
./script/git/git_change_remote_https_to_git.py
# change all repo to https on all remote
.PHONY: repo_use_all_https
repo_use_all_https:
./script/git/git_change_remote_https_to_git.py --git_to_https
###################
# Configuration #
###################
# generate new config.conf
.PHONY: config_install
config_install:
./script/generate_config.sh
.PHONY: config_update
config_update:
# Need http to configure the file config.conf, or will disable it
./run.sh -c config.conf -s --stop-after-init
.PHONY: config_update_over_proxy
config_update_over_proxy:
./run.sh -c config.conf -s --stop-after-init --max-cron-threads 2 --workers 2 --xmlrpc-interface 127.0.0.1 --proxy-mode
.PHONY: config_update_dev
config_update_dev:
./run.sh -c config.conf -s --stop-after-init --max-cron-threads 4 --workers 4
.PHONY: config_update_dev_mono
config_update_dev_mono:
./run.sh -c config.conf -s --stop-after-init --workers 0
.PHONY: config_clear
config_clear:
rm -f ./config.conf
# generate config all repo
.PHONY: config_gen_all
config_gen_all:
echo "config_gen_all"
./script/git/git_repo_update_group.py
./script/generate_config.sh
# generate config repo image_db
.PHONY: config_gen_image_db
config_gen_image_db:
./script/git/git_repo_update_group.py --group base,image_db
./script/generate_config.sh
.PHONY: config_gen_migration
config_gen_migration:
./script/git/git_repo_update_group.py --group base,addons,migration
./script/generate_config.sh
##########
# I18n #
##########
# i18n generation demo_portal
.PHONY: i18n_generate_demo_portal
i18n_generate_demo_portal:
./odoo_bin.sh i18n --database code_generator --module demo_portal --addons_path addons/TechnoLibre_odoo-code-generator
###########
# Clean #
###########
.PHONY: clean
clean:
find . \( -name '__pycache__' -type d -prune -o -name '*.pyc' -o -name '*.pyo' \) -exec rm -rf {} +
###############
# Statistic #
###############
.PHONY: stat_module_evolution_per_year
stat_module_evolution_per_year:
./script/statistic/show_evolution_module.py --before_date "2016-01-01" --more_year 7
.PHONY: stat_module_evolution_per_year_OCA
stat_module_evolution_per_year_OCA:
./script/statistic/show_evolution_module.py --filter "/OCA/" --before_date "2016-01-01" --more_year 7
# Cache
.PHONY: clear_cache
clear_cache:
rm -rf cache artifacts .coverage coverage.json
#######
# IDE #
#######
.PHONY: pycharm_open
pycharm_open:
~/.local/share/JetBrains/Toolbox/scripts/pycharm .
.PHONY: pycharm_configure
pycharm_configure:
# Le venv du dépôt, et non le python système : le script importe xmltodict, qui
# vit dans .venv.erplibre. Appelé directement, il s'arrête sur
# « ModuleNotFoundError: No module named 'xmltodict' » — et c'est cette cible
# que le message d'échec de l'installation recommande. update_env_version.
# pycharm_update() l'appelle déjà ainsi : une seule autorité.
./.venv.erplibre/bin/python ./script/ide/pycharm_configuration.py --init