Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_info(dist_name, index_url=None, env=None, extra_index_url=None):
log = logger.bind(dist_name=dist_name)
tmpdir = tempfile.mkdtemp()
log.debug("created scratch", tmpdir=tmpdir)
try:
with wimpy.working_directory(tmpdir):
data = pipper.get(
dist_name,
index_url=index_url,
env=env,
extra_index_url=extra_index_url,
tmpdir=".",
)
dist_path = data["path"]
# extract any info we may need from downloaded dist right now, so the
# downloaded file can be cleaned up immediately
import_names = _discover_import_names(dist_path)
metadata = _extract_metadata(dist_path)
finally:
log.debug("removing scratch", tmpdir=tmpdir)
shutil.rmtree(tmpdir)
return import_names, metadata
def _best(self):
return pipper.get(
self.pinned,
index_url=self.index_url,
env=self.env,
extra_index_url=self.extra_index_url,
)