details: https://code.tryton.org/tryton/commit/515ce1acffef
branch: default
user: José Antonio Díaz Miralles <[email protected]>
date: Thu Mar 26 22:39:31 2026 +0100
description:
Do not use isolation in update_requirements hook unless necessary
Closes #14707
diffstat:
.hooks/update_requirements | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diffs (51 lines):
diff -r f470ad38e9f8 -r 515ce1acffef .hooks/update_requirements
--- a/.hooks/update_requirements Wed Mar 25 23:52:53 2026 +0100
+++ b/.hooks/update_requirements Thu Mar 26 22:39:31 2026 +0100
@@ -2,6 +2,7 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
+import importlib.metadata
import io
import json
import os
@@ -14,22 +15,35 @@
module_path = os.path.join(root, 'modules')
dependencies = set()
-development_dependencies = {
+build_dependencies = {
+ 'rnc2rng',
'Babel',
+ 'hatchling',
+ 'hatch-tryton',
+ }
+development_dependencies = build_dependencies | {
'Sphinx',
'cookiecutter',
- 'rnc2rng',
'sphinx-lint',
'tox',
}
FNULL = open(os.devnull, 'w')
+_build_deps_installed = True
+try:
+ for requirement in build_dependencies:
+ importlib.metadata.version(Requirement(requirement).name)
+except importlib.metadata.PackageNotFoundError:
+ _build_deps_installed = False
+
def add_dependencies(package):
+ cmd = 'python3 -m build -qq --metadata'
+ if _build_deps_installed:
+ cmd += ' --no-isolation'
metadata = subprocess.check_output(
- 'python3 -m build -n -q --metadata',
- shell=True, encoding='utf-8', cwd=package).strip()
+ cmd, shell=True, encoding='utf-8', cwd=package).strip()
metadata = json.loads(metadata)
for requirement in metadata.get('requires_dist', []):
requirement = Requirement(requirement)