erplibre/Makefile

393 lines
12 KiB
Makefile
Raw Normal View History

SHELL := /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
2025-11-04 23:24:43 -05:00
-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
[ADD] install: mise as Python provider, pyenv as fallback mise lays down a precompiled CPython where pyenv builds one: seconds against one to three minutes, with no -dev package at all. The choice lives in EL_PYTHON_PROVIDER -- auto, mise or pyenv -- and in a single file, lib_python_provider.sh. The rest of the repository only knows venv paths and needs to know none of this. In auto mode an ALREADY installed interpreter wins, whichever provider put it there. mise is never installed on its own, "curl | sh" commits too much for a script to decide -- make install_mise carries that decision. MISE_PYTHON_COMPILE=false forbids it from quietly compiling: without that guard it would fall back to pyenv's own engine, giving us the slowness without the tooling. That is also what stopped gcc from collapsing while building CPython on a low-memory s390x guest, for nothing. One real bug falls along the way: a failed venv did not stop the install, which then went on and failed further down, far from the cause. --- FR --- mise pose un CPython précompilé là où pyenv en compile un : des secondes contre une à trois minutes, et aucun paquet -dev. Le choix vit dans EL_PYTHON_PROVIDER — auto, mise ou pyenv — et dans un seul fichier, lib_python_provider.sh. Le reste du dépôt ne connaît que des chemins de venv et n'a rien à savoir de tout cela. En mode auto, un interpréteur DÉJÀ posé l'emporte, quel qu'en soit le fournisseur. mise n'est jamais installé de lui-même, « curl | sh » engage trop pour qu'un script en décide — make install_mise porte cette décision. MISE_PYTHON_COMPILE=false lui interdit de compiler en silence : sans ce garde, il retomberait sur le moteur de pyenv, et nous aurions sa lenteur sans son outillage. C'est aussi ce qui a évité que gcc s'écroule en bâtissant CPython sur une VM s390x à faible mémoire, inutilement. Un vrai défaut tombe au passage : un venv raté n'arrêtait pas l'installation, qui continuait et échouait plus loin, loin de la cause. Assisted-by: Claude Opus 5
2026-08-11 22:03:40 -04:00
# 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.
[ADD] install: uv to place Python packages, pip as fallback uv replaces pip where it can: the tools venv and the Poetry bootstrap. The choice lives in EL_PIP_PROVIDER -- auto, uv or pip -- and in a single file, lib_pip_provider.sh, on the exact model of the mise/pyenv switch. A uv failure falls back to pip: it is stricter on metadata and rejects packages pip accepts. Three guards. The target always goes through "--python" rather than being inferred from the active venv: poetry.toml declares a "./.venv" uv would also look for. Python 3.7, still used by Odoo 12 and 13, stays on pip. And "uv pip sync" is never used: it would delete pip itself and everything Poetry laid down. One bug falls along the way: the idempotence guard aimed at .venv.erplibre/bin/poetry while Poetry installs into the Odoo venv, so a successful replay reported failure all the same. --- FR --- uv remplace pip là où il le peut : le venv d'outils et l'amorçage de Poetry. Le choix vit dans EL_PIP_PROVIDER — auto, uv ou pip — et dans un seul fichier, lib_pip_provider.sh, sur le modèle exact de l'aiguillage mise/pyenv. Un échec d'uv retombe sur pip : il est plus strict sur les métadonnées et refuse des paquets que pip accepte. Trois gardes. La cible passe toujours par « --python » plutôt que d'être déduite du venv actif : poetry.toml déclare un « ./.venv » qu'uv chercherait aussi. Python 3.7, encore utilisé par Odoo 12 et 13, reste sur pip. Et « uv pip sync » n'est jamais employé : il supprimerait pip lui-même et tout ce que Poetry a posé. Un défaut tombe au passage : le garde d'idempotence visait .venv.erplibre/bin/poetry alors que Poetry s'installe dans le venv Odoo, si bien qu'un rejeu réussi rapportait quand même un échec. Assisted-by: Claude Opus 5
2026-08-11 23:16:26 -04:00
# 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
[ADD] install: mise as Python provider, pyenv as fallback mise lays down a precompiled CPython where pyenv builds one: seconds against one to three minutes, with no -dev package at all. The choice lives in EL_PYTHON_PROVIDER -- auto, mise or pyenv -- and in a single file, lib_python_provider.sh. The rest of the repository only knows venv paths and needs to know none of this. In auto mode an ALREADY installed interpreter wins, whichever provider put it there. mise is never installed on its own, "curl | sh" commits too much for a script to decide -- make install_mise carries that decision. MISE_PYTHON_COMPILE=false forbids it from quietly compiling: without that guard it would fall back to pyenv's own engine, giving us the slowness without the tooling. That is also what stopped gcc from collapsing while building CPython on a low-memory s390x guest, for nothing. One real bug falls along the way: a failed venv did not stop the install, which then went on and failed further down, far from the cause. --- FR --- mise pose un CPython précompilé là où pyenv en compile un : des secondes contre une à trois minutes, et aucun paquet -dev. Le choix vit dans EL_PYTHON_PROVIDER — auto, mise ou pyenv — et dans un seul fichier, lib_python_provider.sh. Le reste du dépôt ne connaît que des chemins de venv et n'a rien à savoir de tout cela. En mode auto, un interpréteur DÉJÀ posé l'emporte, quel qu'en soit le fournisseur. mise n'est jamais installé de lui-même, « curl | sh » engage trop pour qu'un script en décide — make install_mise porte cette décision. MISE_PYTHON_COMPILE=false lui interdit de compiler en silence : sans ce garde, il retomberait sur le moteur de pyenv, et nous aurions sa lenteur sans son outillage. C'est aussi ce qui a évité que gcc s'écroule en bâtissant CPython sur une VM s390x à faible mémoire, inutilement. Un vrai défaut tombe au passage : un venv raté n'arrêtait pas l'installation, qui continuait et échouait plus loin, loin de la cause. Assisted-by: Claude Opus 5
2026-08-11 22:03:40 -04:00
.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"; \
curl -fsSL https://mise.run | sh; \
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
2022-01-24 14:00:54 -05:00
.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
2024-12-20 11:14:30 -05:00
##############
# selenium #
##############
.PHONY: open_selenium
open_selenium:
./.venv.erplibre/bin/python ./script/selenium/web_login.py
2024-12-20 11:14:30 -05:00
############
# 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_erplibre_addons" "./script/make.sh format_supported_addons"
.PHONY: format_code_generator
format_code_generator:
.venv.erplibre/bin/isort --profile black -l 79 ./addons/TechnoLibre_odoo-code-generator/
./script/maintenance/black.sh ./addons/TechnoLibre_odoo-code-generator/
./script/maintenance/prettier_xml.sh ./addons/TechnoLibre_odoo-code-generator/
2022-03-30 04:35:55 -04:00
.PHONY: format_erplibre_addons
format_erplibre_addons:
.venv.erplibre/bin/isort --profile black -l 79 ./addons/ERPLibre_erplibre_addons/
2022-03-30 04:35:55 -04:00
./script/maintenance/black.sh ./addons/ERPLibre_erplibre_addons/
./script/maintenance/prettier_xml.sh ./addons/ERPLibre_erplibre_addons/
.venv.erplibre/bin/isort --profile black -l 79 ./addons/ERPLibre_erplibre_theme_addons/
./script/maintenance/black.sh ./addons/ERPLibre_erplibre_theme_addons/
#./script/maintenance/prettier_xml.sh ./addons/ERPLibre_erplibre_theme_addons/
2022-03-30 04:35:55 -04:00
.PHONY: format_supported_addons
format_supported_addons:
.venv.erplibre/bin/isort --profile black -l 79 ./addons/MathBenTech_erplibre-family-management/
./script/maintenance/black.sh ./addons/MathBenTech_erplibre-family-management/
#./script/maintenance/prettier_xml.sh ./addons/MathBenTech_erplibre-family-management/
.venv.erplibre/bin/isort --profile black -l 79 ./addons/MathBenTech_odoo-business-spending-management-quebec-canada/
./script/maintenance/black.sh ./addons/MathBenTech_odoo-business-spending-management-quebec-canada/
#./script/maintenance/prettier_xml.sh ./addons/MathBenTech_erplibre-family-management/
.PHONY: format_code_generator_template
format_code_generator_template:
.venv.erplibre/bin/isort --profile black -l 79 ./addons/TechnoLibre_odoo-code-generator-template/
./script/maintenance/black.sh ./addons/TechnoLibre_odoo-code-generator-template/
#./script/maintenance/prettier_xml.sh ./addons/TechnoLibre_odoo-code-generator-template/
.PHONY: format_script
format_script:
#.venv.erplibre/bin/isort --profile black -l 79 ./script/ --gitignore
./script/maintenance/black.sh ./script/
.PHONY: format_script_isort_only
format_script_isort_only:
.venv.erplibre/bin/isort --profile black -l 79 ./script/ --gitignore
#########
# 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
2021-03-13 02:21:45 -05:00
# configure all repo
.PHONY: repo_configure_all
repo_configure_all:
./script/manifest/update_manifest_local_dev.sh
2021-03-13 02:21:45 -05:00
# 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
2024-09-11 00:28:46 -04:00
# Cache
.PHONY: clear_cache
clear_cache:
rm -rf cache artifacts .coverage coverage.json
2024-09-27 01:44:52 -04:00
#######
# IDE #
#######
.PHONY: pycharm_open
pycharm_open:
~/.local/share/JetBrains/Toolbox/scripts/pycharm .
.PHONY: pycharm_configure
pycharm_configure:
[FIX] script todo: configurer le projet PyCharm avec le venv, et réessayer Deux défauts empêchaient le .idea d'exister. La configuration d'abord : « make pycharm_configure » lance le script avec le python SYSTÈME, qui n'a pas xmltodict — « ModuleNotFoundError », mesuré. update_env_version.pycharm_update() l'appelle depuis .venv.erplibre ; la cible make et l'étape font désormais pareil. L'ouverture ensuite : la première tentative sur un dépôt neuf peut n'écrire aucun .idea, son configurateur d'interpréteur plantant sur « homeDir is null », là où la suivante l'écrit en 25 s — constaté sur deux VM. L'étape retente donc une fois, en gardant les deux journaux. Vérifié sur erplibre-ubuntu-2604-gnome, caches effacés : erplibre.iml, misc.xml, modules.xml, vcs.xml, et 0 processus survivant. --- EN --- Two defects kept .idea from existing. The configuration first: "make pycharm_configure" runs the script with the SYSTEM python, which lacks xmltodict — "ModuleNotFoundError", measured. update_env_version.pycharm_update() calls it from .venv.erplibre; the make target and the step now do the same. The open next: the first attempt on a fresh repo can write no .idea at all, its interpreter configurator dying on "homeDir is null", where the next one writes it in 25 s — seen on two VMs. The step therefore retries once, keeping both logs. Verified on erplibre-ubuntu-2604-gnome with caches wiped: erplibre.iml, misc.xml, modules.xml, vcs.xml, and 0 surviving processes. Assisted-by: Claude Opus 5
2026-08-19 08:11:12 -04:00
# 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