From 4989c1edbfe6c769b5093843e6579dbe0afa2c57 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 2 Nov 2024 02:09:09 -0400 Subject: [PATCH] [FIX] poetry update: support exclusion of addons.odoo{version} --- script/poetry/poetry_update.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/script/poetry/poetry_update.py b/script/poetry/poetry_update.py index 79d78ce..8bd4380 100755 --- a/script/poetry/poetry_update.py +++ b/script/poetry/poetry_update.py @@ -61,18 +61,26 @@ def get_config(): def get_lst_requirements_txt(): - # Ignore some item in list - lst = [ - a - for a in Path(".").rglob("requirements.[tT][xX][tT]") - if not os.path.dirname(a).startswith(".repo/") - and not os.path.dirname(a).startswith(".venv/") - ] - return lst + return get_file_from_glob("requirements.[tT][xX][tT]") def get_lst_manifest_py(): - return list(Path(".").rglob("__manifest__.py")) + return get_file_from_glob("__manifest__.py") + +def get_file_from_glob(glob_txt): + with open(".odoo-version") as txt: + odoo_version = txt.read() + # with open(".erplibre-version") as txt: + # erplibre_version = txt.read() + lst_v = [] + for a in Path(".").rglob(glob_txt): + a_dirname = os.path.dirname(a) + if a_dirname.startswith(".repo/") or a_dirname.startswith(".venv"): + continue + if a_dirname.startswith("addons") and not a_dirname.startswith(f"addons.odoo{odoo_version}"): + continue + lst_v.append(a) + return lst_v def combine_requirements(config): @@ -402,7 +410,7 @@ def call_poetry_add_build_dependency(): def get_list_ignored(): - with open("./ignore_requirements.txt", "r") as f: + with open("./requirement/ignore_requirements.txt", "r") as f: lst_ignore_requirements = [a.strip() for a in f.readlines()] return lst_ignore_requirements