Ejemplo n.º 1
0
 def _do_task(self, executable, filename, result, resultlock, binary_util):
     self.__logger.debug("Worker %s processes file %s",
                         threading.currentThread().name, filename)
     cmdline = (executable, filename)
     process = subprocess.Popen(cmdline, stdout=subprocess.PIPE, bufsize=1)
     mapper = lambda filename: StringTools.strip_suffixes(
         os.path.basename(filename.strip()),
         binary_util.get_binary_extensions(),
         ignore_case=True)
     self.__process_data(filename,
                         result,
                         resultlock,
                         mapper,
                         stream=process.stdout)
     process.wait()
     self.__logger.debug("%s: return value is %x",
                         threading.currentThread().name, process.returncode)
     if process.returncode not in [0, 255]:
         raise CalledProcessError(process.returncode, cmdline)
     self.__logger.debug("Worker %s finished processing directory %s",
                         threading.currentThread().name, filename)
     self.__logger.debug("Remaining threads: %s", threading.enumerate())
Ejemplo n.º 2
0
 def test_strip_suffixes_2(self):
     self.assertEquals('abc', StringTools.strip_suffixes('abcd', ['a', 'b', 'c', 'd']))
Ejemplo n.º 3
0
 def filename_to_cpp_pseudomodule_func(cpp_extensions):
     return lambda filename: StringTools.strip_suffixes(
         os.path.basename(filename), cpp_extensions)