diff --git a/docs/user-reference.rst b/docs/user-reference.rst index fc1cc7d..d9be601 100644 --- a/docs/user-reference.rst +++ b/docs/user-reference.rst @@ -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" @@ -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 diff --git a/moulin/builders/custom_script.py b/moulin/builders/custom_script.py index 883a7ef..d187d14 100644 --- a/moulin/builders/custom_script.py +++ b/moulin/builders/custom_script.py @@ -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