Created
May 6, 2025 21:26
-
-
Save tsibley/0a725572fdf6f5cb28add525dbfd5920 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
from subprocess import run, PIPE, STDOUT | |
for prog in ["conda", "mamba", "micromamba"]: | |
for arch in [None, "x86_64", ""]: | |
env = {**os.environ} | |
if arch is None: | |
try: | |
del env["CONDA_OVERRIDE_ARCHSPEC"] | |
except KeyError: | |
pass | |
else: | |
env["CONDA_OVERRIDE_ARCHSPEC"] = arch | |
for line in run([prog, "info"], env = env, stdout = PIPE, stderr = STDOUT, text = True, check = True).stdout.splitlines(): | |
if "__archspec" in line: | |
archspec = line.replace("virtual packages :", "").strip() | |
break | |
else: | |
archspec = None | |
version = run([prog, "--version"], stdout = PIPE, text = True, check = True).stdout.strip() | |
version = version.replace(f"{prog} ", "") | |
print(json.dumps({ | |
"prog": f"{prog} ({version})", | |
"CONDA_OVERRIDE_ARCHSPEC": arch if arch is not None else "(not set)", | |
"__archspec": archspec if archspec is not None else "(not present)" })) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment