def unpack(self, dest_path='', force=False): if not dest_path: dest_path = self._downloader.unpacked_path temp_path = os.path.realpath(os.path.join(dest_path, self._name)) _exists = os.path.exists(temp_path) if not self._not_cached: self._unpacked_path = temp_path if _exists else '' if force or self._not_cached or (not _exists): try: Archive.extract(self._packed_path, temp_path) self._unpacked_path = temp_path except: self._unpacked_path = '' pass
def get_file(self, file_name, temp_path=None): if not temp_path: temp_path = self._downloader.temp_path temp_path = os.path.realpath(os.path.join(temp_path, self._name)) _dest_file = Archive.extract_file(self._packed_path, temp_path, file_name) return _dest_file
def unpack(self, force=False): if self._downloader.solid(self): self.unpacked_path = self.packed_path else: exists, dest_path = self._downloader.cache.exists_unpacked( package=self, pkg_path=self.unpacked_path) if exists and not self.unpacked_path: self.unpacked_path = dest_path # if force or not exists: # if not dest_path: # dest_path = self._downloader.unpacked_path # temp_path = os.path.realpath(os.path.join(dest_path, self._name)) # _exists = os.path.exists(temp_path) if not self._not_cached: self.unpacked_path = dest_path if exists else '' # temp_path if exists else '' if force or self._not_cached or (not exists): Archive.extract(self.packed_path, dest_path) # temp_path) self.unpacked_path = dest_path # temp_path self._not_cached = False
def pack(self, src_path): Archive.create(self.packed_path, src_path)
def pack(self): Archive.create(self._args['<OUT>'], self._args['<SOURCE>'])
def pack(self, src_path): Archive.create(self._packed_path, src_path)