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)
| 344 | |
| 345 | |
| 346 | def 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 | |
| 371 | def check_version( |