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

387 lines
11 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.
# 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
.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