|
11 | 11 | HASHES_PATH = SCRIPT_PATH / "hashes.json" |
12 | 12 | CORES = { |
13 | 13 | "atari800": {"repo": "libretro-atari800"}, |
14 | | - "beetle-snes": {"repo": "beetle-bsnes-libretro"}, |
15 | 14 | "beetle-gba": {"repo": "beetle-gba-libretro"}, |
16 | 15 | "beetle-lynx": {"repo": "beetle-lynx-libretro"}, |
17 | 16 | "beetle-ngp": {"repo": "beetle-ngp-libretro"}, |
18 | 17 | "beetle-pce-fast": {"repo": "beetle-pce-fast-libretro"}, |
19 | 18 | "beetle-pcfx": {"repo": "beetle-pcfx-libretro"}, |
20 | 19 | "beetle-psx": {"repo": "beetle-psx-libretro"}, |
21 | 20 | "beetle-saturn": {"repo": "beetle-saturn-libretro"}, |
| 21 | + "beetle-snes": {"repo": "beetle-bsnes-libretro"}, |
22 | 22 | "beetle-supergrafx": {"repo": "beetle-supergrafx-libretro"}, |
23 | | - "beetle-wswan": {"repo": "beetle-wswan-libretro"}, |
24 | 23 | "beetle-vb": {"repo": "beetle-vb-libretro"}, |
| 24 | + "beetle-wswan": {"repo": "beetle-wswan-libretro"}, |
25 | 25 | "bluemsx": {"repo": "bluemsx-libretro"}, |
26 | 26 | "bsnes-mercury": {"repo": "bsnes-mercury"}, |
27 | 27 | "citra": {"repo": "citra", "fetch_submodules": True}, |
|
78 | 78 | "tgbdual": {"repo": "tgbdual-libretro"}, |
79 | 79 | "thepowdertoy": {"repo": "ThePowderToy"}, |
80 | 80 | "tic80": {"repo": "tic-80", "fetch_submodules": True}, |
81 | | - "vba-next": {"repo": "vba-next"}, |
82 | 81 | "vba-m": {"repo": "vbam-libretro"}, |
| 82 | + "vba-next": {"repo": "vba-next"}, |
83 | 83 | "vecx": {"repo": "libretro-vecx"}, |
84 | 84 | "virtualjaguar": {"repo": "virtualjaguar-libretro"}, |
85 | 85 | "yabause": {"repo": "yabause"}, |
@@ -112,21 +112,33 @@ def get_repo_hash(fetcher="fetchFromGitHub", **kwargs): |
112 | 112 | raise ValueError(f"Unsupported fetcher: {fetcher}") |
113 | 113 |
|
114 | 114 |
|
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()) |
117 | 118 |
|
118 | 119 | 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}'...") |
121 | 125 |
|
122 | 126 | return repo_hashes |
123 | 127 |
|
124 | 128 |
|
125 | 129 | 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) |
127 | 139 | info(f"Generating '{HASHES_PATH}'...") |
128 | 140 | 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)) |
130 | 142 | f.write("\n") |
131 | 143 | info("Finished!") |
132 | 144 |
|
|
0 commit comments