# Execute cmake if the product is cmake
len_end_line = 20
res = 0
- nb_proc, make_opt_without_j = get_nb_proc(p_info, config, make_option)
- log_step(logger, header, "MAKE -j" + str(nb_proc))
- res_m = builder.make(nb_proc, make_opt_without_j)
- log_res_step(logger, res_m)
- res += res_m
++
+ if not src.product.product_has_script(p_info):
+ nb_proc, make_opt_without_j = get_nb_proc(p_info, config, make_option)
+ log_step(logger, header, "MAKE -j" + str(nb_proc))
+ if src.architecture.is_windows():
+ res_m = builder.wmake(nb_proc, make_opt_without_j)
+ else:
+ res_m = builder.make(nb_proc, make_opt_without_j)
+ log_res_step(logger, res_m)
+ res += res_m
+ else:
+ scrit_path_display = src.printcolors.printcLabel(p_info.compil_script)
+ log_step(logger, header, "SCRIPT " + scrit_path_display)
+ len_end_line += len(scrit_path_display)
+ res_s = builder.do_script_build(p_info.compil_script)
+ log_res_step(logger, res_s)
+ res += res_s
# Log the result
if res > 0:
fin = open(filein, "r")
fout = open(fileout, "w")
for line in fin:
- fout.write(line.replace(strin, strout))
+ fout.write(line.replace(strin, strout))
+
+ def get_property_in_product_cfg(product_cfg, pprty):
+ if not "properties" in product_cfg:
+ return None
+ if not pprty in product_cfg.properties:
+ return None
- return product_cfg.properties[pprty]
++ return product_cfg.properties[pprty]
shell=True,
stdout=self.logger.logTxtFile,
stderr=subprocess.STDOUT,
- cwd=str(self.build_dir),
+ cwd=str(self.build_dir),
env=self.build_environ.environ.environ)
+ self.put_txt_log_in_appli_log_dir("script")
if res == 0:
return res
else:
return self.do_python_script_build(script, nb_proc)
msg = _("The script %s must have .sh, .bat or .py extension." % script)
- raise src.SatException(msg)
+ raise src.SatException(msg)
+
+ def put_txt_log_in_appli_log_dir(self, file_name):
+ '''Put the txt log (that contain the system logs, like make command
+ output) in the directory <APPLICATION DIR>/LOGS/<product_name>/
+
+ :param file_name Str: the name of the file to write
+ '''
+ if self.logger.logTxtFile == sys.__stdout__:
+ return
+ dir_where_to_put = os.path.join(self.config.APPLICATION.workdir,
+ "LOGS",
+ self.product_info.name)
+ file_path = os.path.join(dir_where_to_put, file_name)
+ src.ensure_path_exists(dir_where_to_put)
+ # write the logTxtFile copy it to the destination, and then recreate
+ # it as it was
+ self.logger.logTxtFile.close()
+ shutil.move(self.logger.txtFilePath, file_path)
+ self.logger.logTxtFile = open(str(self.logger.txtFilePath), 'w')
+ self.logger.logTxtFile.write(open(file_path, "r").read())
-
++