Salome HOME
Pour résoudre un conflit entre les branches master et Windows.
authordpt <salome@IS228312.intra.cea.fr>
Wed, 1 Feb 2017 11:15:32 +0000 (12:15 +0100)
committerdpt <salome@IS228312.intra.cea.fr>
Wed, 1 Feb 2017 11:15:32 +0000 (12:15 +0100)
1  2 
commands/make.py
src/__init__.py
src/compilation.py
src/product.py

index 30dc36fe5fc769198494491a41ce17f391ad996b,4b15ee14546e98c998dd407b09c2606a2ecf3b23..4d62a96b9db715b768a36245842d1fe6ee8df64d
@@@ -142,22 -142,11 +142,23 @@@ def make_product(p_name_info, make_opti
      # 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:
diff --cc src/__init__.py
index 190e6c8ed5d17211c54236b983e1cb1e94265afe,c70c86a113059b37cb28cff0174ea154334708ed..abf59b0e463e74f5a765fc751b5ff0ea1fe154d7
@@@ -377,4 -372,11 +377,11 @@@ def replace_in_file(filein, strin, stro
      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]
index 8d907cfe9666e64dce770f1395ed028317a781b8,8fb8954ee5664775ae8598ae52daefd7d45063d0..d46a2171a149e3a8bc24234453594aaf0a5b91ea
@@@ -417,9 -446,10 +444,10 @@@ CC=\\"hack_libtool\\"%g" libtool''
                                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())
 -        
++        
diff --cc src/product.py
Simple merge