Skip to content

Commit f08c458

Browse files
committed
Set repodata JSON key by Python version
1 parent e5e2116 commit f08c458

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dev/conda/find-pkg.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# NOTE: Logging output must go on stderr,
99
# stdout is captured by the shell script!
1010

11-
import argparse, json, os
11+
import argparse, json, os, sys
1212

1313
parser = argparse.ArgumentParser(description="Show the package name")
1414
parser.add_argument("filename", help="The repodata.json file")
@@ -30,8 +30,12 @@ def fail(msg):
3030
with open(args.filename, "r") as fp:
3131
J = json.load(fp)
3232

33-
# This was "packages" in older versions:
34-
pkg_key = "packages.conda"
33+
# This key seems to change by version:
34+
if sys.version_info.minor == 8:
35+
# Python 3.8.18 2025-02-06:
36+
pkg_key = "packages"
37+
else:
38+
pkg_key = "packages.conda"
3539

3640
def show_repodata(J):
3741
say("full JSON:")

0 commit comments

Comments
 (0)