def _extract(self, jarpath): self.context.log.debug('Extracting idl jar to: %s' % self._EXTRACT_BASE) ZIP.extract(jarpath, self._EXTRACT_BASE) with open_zip(jarpath) as jar: sources = filter(lambda path: path.endswith('.thrift'), jar.namelist()) self.context.log.debug('Found thrift IDL sources: %s' % sources) return sources
def dump(self, jarpath, jarfile): self.context.log.debug(' dumping %s' % jarpath) with temporary_dir() as tmpdir: ZIP.extract(jarpath, tmpdir) for root, dirs, files in os.walk(tmpdir): for file in files: path = os.path.join(root, file) relpath = os.path.relpath(path, tmpdir) if Manifest.PATH != relpath: jarfile.write(path, relpath)
def dump(self, jarpath, jarfile): self.context.log.debug(' dumping %s' % jarpath) with temporary_dir() as tmpdir: try: ZIP.extract(jarpath, tmpdir) except zipfile.BadZipfile: raise TaskError('Bad JAR file, maybe empty: %s' % jarpath) for root, dirs, files in os.walk(tmpdir): for f in files: path = os.path.join(root, f) relpath = os.path.relpath(path, tmpdir) if Manifest.PATH != relpath: jarfile.write(path, relpath)