def ExtractFileFromGlx(self, glc_path, file_in_glc, output_file): """Extract given file from glc file and save it to the given path.""" os_cmd = ("%s/geglxinfo " "--glx=\"%s\" " "--extract_file=\"%s\" " "--output=\"%s\"" % (COMMAND_DIR, glc_path, file_in_glc, output_file)) result = utils.RunCmd(os_cmd) if not os.path.isfile(output_file): return "FAILED: Unable to create {0}\n{1!r}".format( output_file, result) else: return "Extracting %s %s\n" % (output_file, utils.FileSizeAsString(output_file))
def ExtractFilelistFromGlx(self, glc_path, regex): """Extract given file from glc file and save it to the given path.""" logger = self.GetLogger() os_cmd = ("%s/geglxinfo " "--glx=\"%s\" " "--list_files" % (COMMAND_DIR, glc_path)) glx_info = utils.RunCmd(os_cmd) # Checking for errors and logging them if there where any if not glx_info[0] and len(glx_info) == 2: utils.PrintAndLog("ERROR: '%s' running command: '%s'" % (glx_info[1], os_cmd), logger) return [] glx_files = [] for line in glx_info: match = regex.match(line) if match: glx_files.append(match.groups()[0]) return glx_files