[DEV] add parameter in run

This commit is contained in:
Edouard DUPIN 2016-02-10 21:01:57 +01:00
parent 618825ac76
commit 14114158aa
4 changed files with 29 additions and 11 deletions

View File

@ -48,7 +48,7 @@ processor_availlable = 1 # number of CPU core availlable
def run_command_no_lock_out(cmd_line): def run_command_no_lock_out(cmd_line):
# prepare command line: # prepare command line:
args = shlex.split(cmd_line) args = shlex.split(cmd_line)
debug.verbose("cmd = " + str(args)) debug.info("cmd = " + str(args))
try: try:
# create the subprocess # create the subprocess
p = subprocess.Popen(args) p = subprocess.Popen(args)

View File

@ -508,11 +508,23 @@ class Target:
self.un_install_package(module_name) self.un_install_package(module_name)
except AttributeError: except AttributeError:
debug.error("target have no 'un_install_package' instruction") debug.error("target have no 'un_install_package' instruction")
elif action_name == "run": elif action_name[:3] == "run":
try: if len(action_name) > 3:
self.run(module_name) # we have option:
except AttributeError: action_name2 = action_name.replace("\:", "1234COLUMN4321")
debug.error("target have no 'run' instruction") option_list = action_name2.split(":")
if len(option_list) == 0:
debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'")
option_list = []
else:
option_list_tmp = option_list[1:]
option_list = []
for elem in option_list_tmp:
option_list.append(elem.replace("1234COLUMN4321", ":"))
#try:
self.run(module_name, option_list)
#except AttributeError:
# debug.error("target have no 'run' instruction")
elif action_name == "log": elif action_name == "log":
try: try:
self.show_log(module_name) self.show_log(module_name)

View File

@ -137,12 +137,15 @@ class Target(target.Target):
# remove executable link version: # remove executable link version:
tools.remove_file(target_bin_link) tools.remove_file(target_bin_link)
def run(self, pkg_name): def run(self, pkg_name, option_list):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("-- Run package '" + pkg_name + "'") debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", "bin", pkg_name) appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", "bin", pkg_name)
multiprocess.run_command_no_lock_out(appl_path) cmd = appl_path + " "
for elem in option_list:
cmd += elem + " "
multiprocess.run_command_no_lock_out(cmd)
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("-- Run package '" + pkg_name + "' Finished") debug.info("-- Run package '" + pkg_name + "' Finished")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")

View File

@ -147,12 +147,15 @@ class Target(target.Target):
if os.path.exists("/Applications/" + pkg_name + ".app") == True: if os.path.exists("/Applications/" + pkg_name + ".app") == True:
shutil.rmtree("/Applications/" + pkg_name + ".app") shutil.rmtree("/Applications/" + pkg_name + ".app")
def run(self, pkg_name): def run(self, pkg_name, option_list):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("-- Run package '" + pkg_name + "'") debug.info("-- Run package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
appl_path = os.path.join(tools.get_run_path(),self.path_out,self.path_staging,pkg_name + ".app", "bin", pkg_name) appl_path = os.path.join(tools.get_run_path(),self.path_out,self.path_staging,pkg_name + ".app", "bin", pkg_name)
multiprocess.run_command_no_lock_out(appl_path) cmd = appl_path + " "
for elem in option_list:
cmd += elem + " "
multiprocess.run_command_no_lock_out(cmd)
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("-- Run package '" + pkg_name + "' Finished") debug.info("-- Run package '" + pkg_name + "' Finished")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")