Skip to content

Commit 26f6eb8

Browse files
authored
Merge pull request #103 from legalsylvain/IMP-add_configurable_settings
[ADD] extra arguments for 3 commands oca-gen-addons-table, oca-gen-addon-readme, oca-gen-addon-icon
2 parents 8864df4 + ea78960 commit 26f6eb8

File tree

5 files changed

+48
-5
lines changed

5 files changed

+48
-5
lines changed

environment.sample

+10
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,13 @@ ODOO_PASSWORD=
4040
# Root of the PEP 503 simple index where wheels are published
4141
# (publishing disabled if empty)
4242
SIMPLE_INDEX_ROOT=/app/run/simple-index
43+
44+
# Space separated list of extra arguments, for the calls of the
45+
# following command
46+
# * oca-gen-addons-table
47+
# * oca-gen-addon-readme
48+
# * oca-gen-addon-icon
49+
# Exemple : GEN_ADDON_README_EXTRA_ARGS=--no-gen-html
50+
#GEN_ADDONS_TABLE_EXTRA_ARGS=
51+
#GEN_ADDON_README_EXTRA_ARGS=
52+
#GEN_ADDON_ICON_EXTRA_ARGS=

newsfragments/103.feature

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add three new settings available in the ``environment`` file that allow to add extra argument, when calling the libraries ``oca-gen-addons-table``, ``oca-gen-addon-readme`` and ``oca-gen-addon-icon``.

src/oca_github_bot/config.py

+18
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,24 @@ def func_wrapper(*args, **kwargs):
5454
# gen_addons_readme,gen_addons_icon,setuptools_odoo,merge_bot,tag_needs_review
5555
BOT_TASKS = os.environ.get("BOT_TASKS", "all").split(",")
5656

57+
GEN_ADDONS_TABLE_EXTRA_ARGS = (
58+
os.environ.get("GEN_ADDONS_TABLE_EXTRA_ARGS", "")
59+
and os.environ.get("GEN_ADDONS_TABLE_EXTRA_ARGS").split(" ")
60+
or []
61+
)
62+
63+
GEN_ADDON_README_EXTRA_ARGS = (
64+
os.environ.get("GEN_ADDON_README_EXTRA_ARGS", "")
65+
and os.environ.get("GEN_ADDON_README_EXTRA_ARGS").split(" ")
66+
or []
67+
)
68+
69+
GEN_ADDON_ICON_EXTRA_ARGS = (
70+
os.environ.get("GEN_ADDON_ICON_EXTRA_ARGS", "")
71+
and os.environ.get("GEN_ADDON_ICON_EXTRA_ARGS").split(" ")
72+
or []
73+
)
74+
5775
GITHUB_STATUS_IGNORED = [
5876
"ci/runbot",
5977
"codecov/project",

src/oca_github_bot/process.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ def call(cmd, cwd):
1212
return subprocess.call(cmd, cwd=cwd)
1313

1414

15-
def check_call(cmd, cwd, log_error=True):
15+
def check_call(cmd, cwd, log_error=True, extra_cmd_args=False):
16+
if extra_cmd_args:
17+
cmd += extra_cmd_args
1618
cp = subprocess.run(
1719
cmd,
1820
universal_newlines=True,

src/oca_github_bot/tasks/main_branch_bot.py

+16-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33

44
from .. import github, manifest
55
from ..build_wheels import build_and_publish_wheels
6-
from ..config import SIMPLE_INDEX_ROOT, switchable
6+
from ..config import (
7+
GEN_ADDON_ICON_EXTRA_ARGS,
8+
GEN_ADDON_README_EXTRA_ARGS,
9+
GEN_ADDONS_TABLE_EXTRA_ARGS,
10+
SIMPLE_INDEX_ROOT,
11+
switchable,
12+
)
713
from ..github import git_push_if_needed, temporary_clone
814
from ..process import check_call
915
from ..queue import getLogger, task
@@ -16,7 +22,9 @@
1622
def _gen_addons_table(org, repo, branch, cwd):
1723
_logger.info("oca-gen-addons-table in %s/%s@%s", org, repo, branch)
1824
gen_addons_table_cmd = ["oca-gen-addons-table", "--commit"]
19-
check_call(gen_addons_table_cmd, cwd=cwd)
25+
check_call(
26+
gen_addons_table_cmd, cwd=cwd, extra_cmd_args=GEN_ADDONS_TABLE_EXTRA_ARGS
27+
)
2028

2129

2230
@switchable("gen_addons_readme")
@@ -34,7 +42,9 @@ def _gen_addons_readme(org, repo, branch, cwd):
3442
cwd,
3543
"--commit",
3644
]
37-
check_call(gen_addon_readme_cmd, cwd=cwd)
45+
check_call(
46+
gen_addon_readme_cmd, cwd=cwd, extra_cmd_args=GEN_ADDON_README_EXTRA_ARGS
47+
)
3848

3949

4050
@switchable("gen_addons_icon")
@@ -56,7 +66,9 @@ def _setuptools_odoo_make_default(org, repo, branch, cwd):
5666
"--clean",
5767
"--commit",
5868
]
59-
check_call(make_default_setup_cmd, cwd=cwd)
69+
check_call(
70+
make_default_setup_cmd, cwd=cwd, extra_cmd_args=GEN_ADDON_ICON_EXTRA_ARGS
71+
)
6072

6173

6274
def main_branch_bot_actions(org, repo, branch, cwd):

0 commit comments

Comments
 (0)