Skip to content

Commit 33478a1

Browse files
committed
libretro: make update.py script accept individual cores to update
1 parent 0786634 commit 33478a1

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

pkgs/misc/emulators/retroarch/update.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
HASHES_PATH = SCRIPT_PATH / "hashes.json"
1212
CORES = {
1313
"atari800": {"repo": "libretro-atari800"},
14-
"beetle-snes": {"repo": "beetle-bsnes-libretro"},
1514
"beetle-gba": {"repo": "beetle-gba-libretro"},
1615
"beetle-lynx": {"repo": "beetle-lynx-libretro"},
1716
"beetle-ngp": {"repo": "beetle-ngp-libretro"},
1817
"beetle-pce-fast": {"repo": "beetle-pce-fast-libretro"},
1918
"beetle-pcfx": {"repo": "beetle-pcfx-libretro"},
2019
"beetle-psx": {"repo": "beetle-psx-libretro"},
2120
"beetle-saturn": {"repo": "beetle-saturn-libretro"},
21+
"beetle-snes": {"repo": "beetle-bsnes-libretro"},
2222
"beetle-supergrafx": {"repo": "beetle-supergrafx-libretro"},
23-
"beetle-wswan": {"repo": "beetle-wswan-libretro"},
2423
"beetle-vb": {"repo": "beetle-vb-libretro"},
24+
"beetle-wswan": {"repo": "beetle-wswan-libretro"},
2525
"bluemsx": {"repo": "bluemsx-libretro"},
2626
"bsnes-mercury": {"repo": "bsnes-mercury"},
2727
"citra": {"repo": "citra", "fetch_submodules": True},
@@ -78,8 +78,8 @@
7878
"tgbdual": {"repo": "tgbdual-libretro"},
7979
"thepowdertoy": {"repo": "ThePowderToy"},
8080
"tic80": {"repo": "tic-80", "fetch_submodules": True},
81-
"vba-next": {"repo": "vba-next"},
8281
"vba-m": {"repo": "vbam-libretro"},
82+
"vba-next": {"repo": "vba-next"},
8383
"vecx": {"repo": "libretro-vecx"},
8484
"virtualjaguar": {"repo": "virtualjaguar-libretro"},
8585
"yabause": {"repo": "yabause"},
@@ -112,21 +112,33 @@ def get_repo_hash(fetcher="fetchFromGitHub", **kwargs):
112112
raise ValueError(f"Unsupported fetcher: {fetcher}")
113113

114114

115-
def get_repo_hashes():
116-
repo_hashes = {}
115+
def get_repo_hashes(cores_to_update=[]):
116+
with open(HASHES_PATH) as f:
117+
repo_hashes = json.loads(f.read())
117118

118119
for core, repo in CORES.items():
119-
info(f"Getting repo hash for '{core}'...")
120-
repo_hashes[core] = get_repo_hash(**repo)
120+
if core in cores_to_update:
121+
info(f"Getting repo hash for '{core}'...")
122+
repo_hashes[core] = get_repo_hash(**repo)
123+
else:
124+
info(f"Skipping '{core}'...")
121125

122126
return repo_hashes
123127

124128

125129
def main():
126-
repo_hashes = get_repo_hashes()
130+
# If you don't want to update all cores, pass the name of the cores you
131+
# want to update on the command line. E.g.:
132+
# $ ./update.py citra snes9x
133+
if len(sys.argv) > 1:
134+
cores_to_update = sys.argv[1:]
135+
else:
136+
cores_to_update = CORES.keys()
137+
138+
repo_hashes = get_repo_hashes(cores_to_update)
127139
info(f"Generating '{HASHES_PATH}'...")
128140
with open(HASHES_PATH, "w") as f:
129-
f.write(json.dumps(repo_hashes, indent=4))
141+
f.write(json.dumps(dict(sorted(repo_hashes.items())), indent=4))
130142
f.write("\n")
131143
info("Finished!")
132144

0 commit comments

Comments
 (0)