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

Function _build_init_run_block

constructor/docker_build.py:28–47  ·  view source on GitHub ↗
(info)

Source from the content-addressed store, hash-verified

26
27
28def _build_init_run_block(info):
29 if not info.get("_has_conda"):
30 return ""
31
32 initialize_conda = info.get("initialize_conda")
33 if not initialize_conda or initialize_conda == "condabin":
34 return ""
35
36 run = 'RUN "${PREFIX}/bin/conda" init --all'
37
38 for record in info.get("_all_pkg_records", ()):
39 if not record.name == "mamba":
40 continue
41 if check_version(record.version, min_version="2.0.0"):
42 run += ' && "${PREFIX}/bin/mamba" shell init --shell bash'
43 else:
44 run += ' && "${PREFIX}/bin/python" -m mamba.mamba init --all'
45 break
46
47 return run
48
49
50def generate_dockerfile(info: dict, docker_dir: Path) -> Path:

Callers 1

generate_dockerfileFunction · 0.85

Calls 2

check_versionFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected