erplibre/docker/repo_manifest_gen_org_prefix_path.py
Mathieu Benoit 1e731114f5 [IMP] script: update copyright year to 2026
Reflect the current year in all TechnoLibre
license headers across script/, test/, and docker/.

Generated by Claude Code 2.1.74 model claude-sonnet-4-6

Co-Authored-By: Mathieu Benoit <mathben@technolibre.ca>
2026-03-11 23:16:05 -04:00

52 lines
1.4 KiB
Python
Executable file

#!/usr/bin/env python
# © 2021-2026 TechnoLibre (http://www.technolibre.ca)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
import argparse
import configparser
from os import listdir
from os.path import abspath, isdir, join
parser = argparse.ArgumentParser(prog="Configure base dir for all addons")
parser.add_argument("addonsBaseDir", help="Path where addons are cloned.")
parser.add_argument(
"srcConfigPath",
help="Path where we retrieve source config file to adapt with new "
"addons path.",
)
parser.add_argument(
"dstConfigPath", help="Path to save adapted configuration."
)
args = parser.parse_args()
addonsBaseDir = args.addonsBaseDir
srcConfigPath = args.srcConfigPath
dstConfigPath = args.dstConfigPath
addonsDirs = [
abspath(join(addonsBaseDir, f))
for f in listdir(addonsBaseDir)
if isdir(join(addonsBaseDir, f))
]
with open(".odoo-version", "r") as f:
odoo_version = f.readline().strip()
str_odoo_version = f"odoo{odoo_version}"
# addonsDirs.insert(0, "/usr/lib/python3/dist-packages/odoo/addons/")
addonsDirs.insert(0, f"/ERPLibre/{str_odoo_version}/addons/addons")
addonsDirs.insert(0, f"/ERPLibre/{str_odoo_version}/odoo/addons")
config = configparser.ConfigParser()
config.read(srcConfigPath)
separator = ","
config.set("options", "addons_path", separator.join(addonsDirs))
print(config.get("options", "addons_path"))
with open(dstConfigPath, "w") as configfile:
config.write(configfile)