Exemple #1
0
 def command(self, name, function, *args):
     print("  {} {} : ".format(name, self.name), end="", flush=True)
     log = pj(self._log_dir, 'cmd_{}_{}.log'.format(name, self.name))
     context = Context(name, log, True)
     try:
         start_time = time.time()
         ret = function(*args, context=context)
         context._finalise()
         duration = time.time() - start_time
         print(colorize("OK"), "({:.1f}s)".format(duration))
         return ret
     except WarningMessage as e:
         print(e)
     except SkipCommand as e:
         print(e)
     except subprocess.CalledProcessError:
         print(colorize("ERROR"))
         try:
             with open(log, 'r') as f:
                 print(f.read())
         except:
             pass
         raise StopBuild()
     except:
         print(colorize("ERROR"))
         raise
Exemple #2
0
 def command(self, name, function, *args):
     print("  {} {} : ".format(name, self.name), end="", flush=True)
     log = pj(self._log_dir, 'cmd_{}_{}.log'.format(name, self.name))
     context = Context(name, log, True)
     try:
         ret = function(*args, context=context)
         context._finalise()
         print("OK")
         return ret
     except SkipCommand:
         print("SKIP")
     except subprocess.CalledProcessError:
         print("ERROR")
         try:
             with open(log, 'r') as f:
                 print(f.read())
         except:
             pass
         raise StopBuild()
     except:
         print("ERROR")
         raise
Exemple #3
0
 def command(self, name, function, *args):
     print("  {} {} : ".format(name, self.name), end="", flush=True)
     log = pj(self._log_dir, 'cmd_{}_{}.log'.format(name, self.name))
     context = Context(name, log, self.target.force_native_build)
     try:
         start_time = time.time()
         ret = function(*args, context=context)
         context._finalise()
         duration = time.time() - start_time
         print("OK ({:.1f}s)".format(duration))
         return ret
     except SkipCommand:
         print("SKIP")
     except subprocess.CalledProcessError:
         print("ERROR")
         try:
             with open(log, 'r') as f:
                 print(f.read())
         except:
             pass
         raise StopBuild()
     except:
         print("ERROR")
         raise