[DEV] add parameter in run
This commit is contained in:
parent
618825ac76
commit
14114158aa
@ -48,7 +48,7 @@ processor_availlable = 1 # number of CPU core availlable
|
||||
def run_command_no_lock_out(cmd_line):
|
||||
# prepare command line:
|
||||
args = shlex.split(cmd_line)
|
||||
debug.verbose("cmd = " + str(args))
|
||||
debug.info("cmd = " + str(args))
|
||||
try:
|
||||
# create the subprocess
|
||||
p = subprocess.Popen(args)
|
||||
|
@ -508,11 +508,23 @@ class Target:
|
||||
self.un_install_package(module_name)
|
||||
except AttributeError:
|
||||
debug.error("target have no 'un_install_package' instruction")
|
||||
elif action_name == "run":
|
||||
try:
|
||||
self.run(module_name)
|
||||
except AttributeError:
|
||||
debug.error("target have no 'run' instruction")
|
||||
elif action_name[:3] == "run":
|
||||
if len(action_name) > 3:
|
||||
# we have option:
|
||||
action_name2 = action_name.replace("\:", "1234COLUMN4321")
|
||||
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":
|
||||
try:
|
||||
self.show_log(module_name)
|
||||
|
@ -137,12 +137,15 @@ class Target(target.Target):
|
||||
# remove executable link version:
|
||||
tools.remove_file(target_bin_link)
|
||||
|
||||
def run(self, pkg_name):
|
||||
def run(self, pkg_name, option_list):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("-- Run package '" + pkg_name + "'")
|
||||
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
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.info("-- Run package '" + pkg_name + "' Finished")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
@ -147,12 +147,15 @@ class Target(target.Target):
|
||||
if os.path.exists("/Applications/" + pkg_name + ".app") == True:
|
||||
shutil.rmtree("/Applications/" + pkg_name + ".app")
|
||||
|
||||
def run(self, pkg_name):
|
||||
def run(self, pkg_name, option_list):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("-- Run package '" + pkg_name + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
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.info("-- Run package '" + pkg_name + "' Finished")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
Loading…
x
Reference in New Issue
Block a user