erplibre/Makefile
Mathieu Benoit 70d9ad456c [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-16 23:33:49 -04:00

368 lines
10 KiB
Makefile

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
-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.
.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
.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_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/
.PHONY: format_erplibre_addons
format_erplibre_addons:
.venv.erplibre/bin/isort --profile black -l 79 ./addons/ERPLibre_erplibre_addons/
./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/
.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
# 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:
./script/ide/pycharm_configuration.py --init