MCPcopy Create free account
hub / github.com/conda/constructor / _fetch_precs

Function _fetch_precs

constructor/fcp.py:376–411  ·  view source on GitHub ↗
(precs, download_dir, transmute_file_type="")

Source from the content-addressed store, hash-verified

374
375
376def _fetch_precs(precs, download_dir, transmute_file_type=""):
377 pc_recs = _fetch(download_dir, precs)
378 # Constructor cache directory can have multiple packages from different
379 # installer creations. Filter out those which the solver picked.
380 precs_fns = [x.fn for x in precs]
381 pc_recs = [x for x in pc_recs if x.fn in precs_fns]
382 _urls = [(pc_rec.url, pc_rec.md5) for pc_rec in pc_recs]
383 has_conda = any(pc_rec.name == "conda" for pc_rec in pc_recs)
384
385 dists = list(prec.fn for prec in precs)
386
387 if transmute_file_type != "":
388 new_dists = []
389 import conda_package_handling.api
390
391 for dist in dists:
392 if dist.endswith(transmute_file_type):
393 new_dists.append(dist)
394 elif dist.endswith(".tar.bz2"):
395 dist = filename_dist(dist)
396 new_file_name = "%s%s" % (dist[:-8], transmute_file_type)
397 new_dists.append(new_file_name)
398 new_file_name = join(download_dir, new_file_name)
399 if os.path.exists(new_file_name):
400 continue
401 logger.info("transmuting %s", dist)
402 conda_package_handling.api.transmute(
403 os.path.join(download_dir, dist),
404 transmute_file_type,
405 out_folder=download_dir,
406 )
407 else:
408 new_dists.append(dist)
409 dists = new_dists
410
411 return pc_recs, _urls, dists, has_conda
412
413
414def _main(

Callers 1

_mainFunction · 0.85

Calls 2

filename_distFunction · 0.90
_fetchFunction · 0.85

Tested by

no test coverage detected