def inner(self): data = extraction_fce(self) if virtualenv is None or not self.venv: logger.debug("Skipping virtualenv metadata extraction.") return data temp_dir = tempfile.mkdtemp() try: extractor = virtualenv.VirtualEnv(self.name, temp_dir, self.name_convertor, self.base_python_version) data.set_from(extractor.get_venv_data, update=True) except exc.VirtualenvFailException as e: logger.error("{}, skipping virtualenv metadata extraction.".format(e)) finally: shutil.rmtree(temp_dir) return data
def data_from_venv(self): """Returns all metadata extractable from virtualenv object. Returns: dictionary containing metadata extracted from virtualenv """ if not self.venv: return {} temp_dir = tempfile.mkdtemp() try: extractor = virtualenv.VirtualEnv(self.name, temp_dir, self.name_convertor, self.base_python_version) return extractor.get_venv_data except VirtualenvFailException as e: logger.error("{}, skipping virtualenv metadata extraction".format(e)) return {} finally: shutil.rmtree(temp_dir)