Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] extra arguments for 3 commands oca-gen-addons-table, oca-gen-addon-readme, oca-gen-addon-icon #103

Merged
merged 1 commit into from
Mar 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions environment.sample
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,13 @@ ODOO_PASSWORD=
# Root of the PEP 503 simple index where wheels are published
# (publishing disabled if empty)
SIMPLE_INDEX_ROOT=/app/run/simple-index

# Space separated list of extra arguments, for the calls of the
# following command
# * oca-gen-addons-table
# * oca-gen-addon-readme
# * oca-gen-addon-icon
# Exemple : GEN_ADDON_README_EXTRA_ARGS=--no-gen-html
#GEN_ADDONS_TABLE_EXTRA_ARGS=
#GEN_ADDON_README_EXTRA_ARGS=
#GEN_ADDON_ICON_EXTRA_ARGS=
1 change: 1 addition & 0 deletions newsfragments/103.feature
Original file line number Diff line number Diff line change
@@ -0,0 +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``.
18 changes: 18 additions & 0 deletions src/oca_github_bot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ def func_wrapper(*args, **kwargs):
# gen_addons_readme,gen_addons_icon,setuptools_odoo,merge_bot,tag_needs_review
BOT_TASKS = os.environ.get("BOT_TASKS", "all").split(",")

GEN_ADDONS_TABLE_EXTRA_ARGS = (
os.environ.get("GEN_ADDONS_TABLE_EXTRA_ARGS", "")
and os.environ.get("GEN_ADDONS_TABLE_EXTRA_ARGS").split(" ")
or []
)

GEN_ADDON_README_EXTRA_ARGS = (
os.environ.get("GEN_ADDON_README_EXTRA_ARGS", "")
and os.environ.get("GEN_ADDON_README_EXTRA_ARGS").split(" ")
or []
)

GEN_ADDON_ICON_EXTRA_ARGS = (
os.environ.get("GEN_ADDON_ICON_EXTRA_ARGS", "")
and os.environ.get("GEN_ADDON_ICON_EXTRA_ARGS").split(" ")
or []
)

GITHUB_STATUS_IGNORED = [
"ci/runbot",
"codecov/project",
Expand Down
4 changes: 3 additions & 1 deletion src/oca_github_bot/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ def call(cmd, cwd):
return subprocess.call(cmd, cwd=cwd)


def check_call(cmd, cwd, log_error=True):
def check_call(cmd, cwd, log_error=True, extra_cmd_args=False):
legalsylvain marked this conversation as resolved.
Show resolved Hide resolved
if extra_cmd_args:
cmd += extra_cmd_args
cp = subprocess.run(
cmd,
universal_newlines=True,
Expand Down
20 changes: 16 additions & 4 deletions src/oca_github_bot/tasks/main_branch_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@

from .. import github, manifest
from ..build_wheels import build_and_publish_wheels
from ..config import SIMPLE_INDEX_ROOT, switchable
from ..config import (
GEN_ADDON_ICON_EXTRA_ARGS,
GEN_ADDON_README_EXTRA_ARGS,
GEN_ADDONS_TABLE_EXTRA_ARGS,
SIMPLE_INDEX_ROOT,
switchable,
)
from ..github import git_push_if_needed, temporary_clone
from ..process import check_call
from ..queue import getLogger, task
Expand All @@ -16,7 +22,9 @@
def _gen_addons_table(org, repo, branch, cwd):
_logger.info("oca-gen-addons-table in %s/%s@%s", org, repo, branch)
gen_addons_table_cmd = ["oca-gen-addons-table", "--commit"]
check_call(gen_addons_table_cmd, cwd=cwd)
check_call(
gen_addons_table_cmd, cwd=cwd, extra_cmd_args=GEN_ADDONS_TABLE_EXTRA_ARGS
)


@switchable("gen_addons_readme")
Expand All @@ -34,7 +42,9 @@ def _gen_addons_readme(org, repo, branch, cwd):
cwd,
"--commit",
]
check_call(gen_addon_readme_cmd, cwd=cwd)
check_call(
gen_addon_readme_cmd, cwd=cwd, extra_cmd_args=GEN_ADDON_README_EXTRA_ARGS
)


@switchable("gen_addons_icon")
Expand All @@ -56,7 +66,9 @@ def _setuptools_odoo_make_default(org, repo, branch, cwd):
"--clean",
"--commit",
]
check_call(make_default_setup_cmd, cwd=cwd)
check_call(
make_default_setup_cmd, cwd=cwd, extra_cmd_args=GEN_ADDON_ICON_EXTRA_ARGS
)


def main_branch_bot_actions(org, repo, branch, cwd):
Expand Down