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

Function format_conda_exe_name

constructor/utils.py:346–368  ·  view source on GitHub ↗

Return a formatted alias for given stand-alone executable. - If given executable cannot be identified, returns the basename of given executable. - If stand-alone conda is identified, returns '_conda'. - If stand-alone mamba/micromamba is identified, returns 'micromamba'. Para

(conda_exe: str | Path)

Source from the content-addressed store, hash-verified

344
345
346def format_conda_exe_name(conda_exe: str | Path) -> str:
347 """Return a formatted alias for given stand-alone executable.
348
349 - If given executable cannot be identified, returns the basename of given executable.
350 - If stand-alone conda is identified, returns '_conda'.
351 - If stand-alone mamba/micromamba is identified, returns 'micromamba'.
352
353 Parameters::
354 - conda_exe: str | Path
355 Path to the conda executable to be accounted for.
356 """
357 conda_exe_name, _ = identify_conda_exe(conda_exe)
358 if conda_exe_name is None:
359 # This implies that identify_conda_exe failed
360 return Path(conda_exe).name
361 if conda_exe_name == StandaloneExe.CONDA:
362 return "_conda"
363 elif conda_exe_name == StandaloneExe.MAMBA:
364 return "micromamba"
365 else:
366 # This should never happen, but as a safe-guard in case `identify_conda_exe` is changed without
367 # accounting for this function.
368 raise RuntimeError("Unable to format conda exe name")
369
370
371def check_version(

Callers 5

test_macos_signingFunction · 0.90
generate_dockerfileFunction · 0.85
get_headerFunction · 0.85
move_scriptFunction · 0.85
createFunction · 0.85

Calls 1

identify_conda_exeFunction · 0.85

Tested by 1

test_macos_signingFunction · 0.72