소스 검색

Start implementing dynamic path mounts

Binaries may not have the path that the configuration files expect
them to, so we need to make validation select binaries on custom
paths.
nosoop 10 달 전
부모
커밋
2f8aafa3f7
1개의 변경된 파일17개의 추가작업 그리고 7개의 파일을 삭제
  1. 17 7
      src/smgdc/app.py

+ 17 - 7
src/smgdc/app.py

@@ -21,14 +21,24 @@ def main() -> None:
     else:
         validation_files.add(args.validation_path)
 
+    bin_mounts = {
+        "232250/tf/bin/server.dll": "server.dll",
+        "232250/tf/bin/server_srv.so": "server_srv.so",
+    }
+
+    candidate_targets: list[PlatformBinary] = []
+    for mount, bin in bin_mounts.items():
+        bin_path = pathlib.Path(bin)
+        loaded_bin: PlatformBinary
+        if bin_path.suffix == ".so":
+            loaded_bin = LinuxBinary(bin_path)
+        elif bin_path.suffix == ".dll":
+            loaded_bin = WindowsBinary(bin_path)
+        else:
+            raise ValueError(f"Unknown bin suffix {bin_path.suffix}")
+        loaded_bin.path = pathlib.Path(mount)
+        candidate_targets.append(loaded_bin)
 
-    linux_target = LinuxBinary(pathlib.Path("server_srv.so"))
-    windows_target = WindowsBinary(pathlib.Path("server.dll"))
-
-    linux_target.path = pathlib.Path("232250/tf/bin/server_srv.so")
-    windows_target.path = pathlib.Path("232250/tf/bin/server.dll")
-
-    candidate_targets: list[PlatformBinary] = [linux_target, windows_target]
     for validation_file in sorted(validation_files):
         header = validation_file.stem
         if args.validation_path.is_dir():