tools/client/prepare_standalone_client.py (1341B)
1 """Create a validation client containing assets and vendor libraries only.""" 2 3 import json 4 import pathlib 5 import shutil 6 7 8 root = pathlib.Path(__file__).resolve().parents[2] 9 source = root / "anarchy-vanilla-14.9.1" 10 destination = root / "anarchy-runtime-14.9.1" 11 assert not destination.exists(), f"{destination} already exists" 12 destination.mkdir() 13 scope = json.loads((root / "client/scope.json").read_text()) 14 15 # Copy assets rather than sharing writable hard links with the reference client. 16 for name in ("cd_image", "Setupf"): 17 shutil.copytree(source / name, destination / name) 18 for path in source.iterdir(): 19 if not path.is_file() or path.name.lower() == "stderr.txt": 20 continue 21 if path.suffix.lower() in (".exe", ".dll") and path.name.lower() not in scope["vendors"]: 22 continue 23 shutil.copy2(path, destination / path.name) 24 (destination / "Prefs/localtest").mkdir(parents=True) 25 shutil.copy2(source / "Prefs/Main.cfg", destination / "Prefs/Main.cfg") 26 shutil.copy2(source / "Prefs/localtest/Login.cfg", destination / "Prefs/localtest/Login.cfg") 27 (destination / "Screenshots").mkdir() 28 29 game_names = {module["name"].lower() for module in scope["game"]} 30 assert not [path for path in destination.rglob("*") if path.name.lower() in game_names] 31 print(f"Prepared {destination}: assets and vendors, no original game EXE/DLL")