50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
"""Runs inside the archipelago Docker image. Reports which game (if any)
|
|
a single mounted .apworld registers itself as under Archipelago's own
|
|
World registry - the import/registration step only, no seed generation.
|
|
|
|
Used to verify a freshly downloaded .apworld's actual content matches
|
|
the sheet row that fetched it, rather than trusting release/asset
|
|
name-matching alone (see AssetMatcher): the filename
|
|
and release title are just text an author chose, but AutoWorldRegister
|
|
is filled from the World class's own "game" attribute, which is what
|
|
Archipelago itself will treat this file as - the authoritative source.
|
|
"""
|
|
|
|
import argparse
|
|
import json
|
|
import sys
|
|
import warnings
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("--apworld", required=True)
|
|
args = parser.parse_args()
|
|
|
|
warnings.simplefilter("ignore")
|
|
|
|
try:
|
|
import worlds
|
|
from worlds.AutoWorld import AutoWorldRegister
|
|
except BaseException as error:
|
|
# The apworld (or something it imports) crashed outright - that's
|
|
# itself a meaningful signal (this file is broken/wrong), not an
|
|
# infrastructure failure, so it's still reported as a clean JSON
|
|
# result rather than a non-zero exit / stack trace.
|
|
print(json.dumps({"games": [], "detail": f"{type(error).__name__}: {error}"}))
|
|
return 0
|
|
|
|
games = [
|
|
name for name, world_type in AutoWorldRegister.world_types.items()
|
|
if str(getattr(world_type, "zip_path", "") or "") == args.apworld
|
|
]
|
|
print(json.dumps({
|
|
"games": games,
|
|
"detail": None if games else f"failed_world_loads={worlds.failed_world_loads}",
|
|
}))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|