def _common(self, infodict): """Internal function. Performs commonly supported compression or decompression commands. :param infodict: dict as returned by this class's create_infodict() :type infodict: dictionary :returns: boolean """ if not infodict['mode'] or not self.is_supported(infodict['mode']): self.logger.error("ERROR: CompressMap; %s mode: %s not correctly " "set!", self.loaded_type[0], infodict['mode'] ) return False # Avoid modifying the source dictionary cmdinfo = infodict.copy() # obtain the pointer to the mode class to use cmdlist = self._map[cmdinfo['mode']] # for compression, add the file extension if enabled if cmdinfo['auto-ext']: cmdinfo['filename'] += self.extension_separator + \ self.extension(cmdinfo["mode"]) # Do the string substitution opts = ' '.join(cmdlist.args) %(cmdinfo) args = ' '.join([cmdlist.cmd, opts]) # now run the (de)compressor command in a subprocess # return it's success/fail return value return subcmd(args, cmdlist.id, env=self.env)
def _common(self, infodict): """Internal function. Performs commonly supported compression or decompression commands. :param infodict: dict as returned by this class's create_infodict() :type infodict: dictionary :returns: boolean """ if not infodict['mode'] or not self.is_supported(infodict['mode']): self.logger.error( "ERROR: CompressMap; %s mode: %s not correctly " "set!", self.loaded_type[0], infodict['mode']) return False # Avoid modifying the source dictionary cmdinfo = infodict.copy() # obtain the pointer to the mode class to use cmdlist = self._map[cmdinfo['mode']] # for compression, add the file extension if enabled if cmdinfo['auto-ext']: cmdinfo['filename'] += self.extension_separator + \ self.extension(cmdinfo["mode"]) cmdargs = self._sub_other_options(cmdlist.args, cmdinfo) # Do the string substitution opts = ' '.join(cmdargs) % (cmdinfo) args = ' '.join([cmdlist.cmd, opts]) self.logger.debug("COMPRESS: _common(); command args: %s", args) # now run the (de)compressor command in a subprocess # return it's success/fail return value return subcmd(args, cmdlist.id, env=self.env)