Skip to content

Commit

Permalink
custom_script: make 'args' parameter as list
Browse files Browse the repository at this point in the history
'args' parameter can be pointed as string or as list

  args: "-v -h"
or
  args:
    - "-v"
    - "-h"

Signed-off-by: Dmytro Semenets <[email protected]>
Reviewed-by: Volodymyr Babchuk <[email protected]>
  • Loading branch information
dsemenets committed Feb 26, 2024
1 parent 9a7dbd1 commit 670e0a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/user-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,9 @@ script as parameter
type: custom_script # Should be 'custom_script'
work_dir : "script_workdir"
script: "path/to/script/custom_script.py"
args:
- "argument1"
- "argument2"
config:
items:
"rootfs": "images/spider/rootfs.tar.bz2"
Expand Down Expand Up @@ -732,7 +735,8 @@ Mandatory options:

Optional parameters:

* :code:`args` - additional arguments should be passed to :code:`script`
* :code:`args` - additional arguments should be passed to :code:`script`. Can be passed as
string or list

* :code:`additional_deps` - list of additional dependencies. This is
basically :code:`target_images` produced by other components. You
Expand Down
7 changes: 6 additions & 1 deletion moulin/builders/custom_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,15 @@ def gen_build(self):
self.generator.build(f"conf-{self.name}", "phony", local_conf_target)
self.generator.newline()

args_node = self.conf.get("args", "")
if args_node.is_list:
args = " ".join([x.as_str for x in args_node])
else:
args = args_node.as_str
self.generator.build(targets, "cs_build", deps, variables=dict(
common_variables,
config_file=local_conf_file,
args=self.conf.get("args", "").as_str))
args=args))
self.generator.newline()

return targets
Expand Down

0 comments on commit 670e0a2

Please sign in to comment.