diff options
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | README.md | 21 | ||||
| -rw-r--r-- | src/sailfish_devel_mcp/config.py.template (renamed from src/sailfish_devel_mcp/config.py) | 0 | ||||
| -rw-r--r-- | tests/test_server.py | 22 |
4 files changed, 36 insertions, 9 deletions
@@ -6,4 +6,4 @@ __pycache__/ .venv/ build/ dist/ - +/src/sailfish_devel_mcp/config.py @@ -30,10 +30,11 @@ The server currently exposes tools for: - RPM spec metadata summaries - QML translation search and Sailfish ternary translation checks -The committed defaults are deliberately generic. Device tools default to the -placeholder SSH target `root@device`, the Sailfish user-session bus at -`/run/user/100000/dbus/user_bus_socket`, `~/git` as the local source root, -`~/OBS` as the OBS checkout root, and the vendored build helper at +The committed configuration template defaults are deliberately generic. +Device tools default to the placeholder SSH target `root@device`, the Sailfish +user-session bus at `/run/user/100000/dbus/user_bus_socket`, `~/git` as the +local source root, `~/OBS` as the OBS checkout root, and the vendored build +helper at `src/sailfish_devel_mcp/vendor/build_sailfishos.py`. Put a config file at `~/.config/sailfish-devel-mcp/config.json` or pass `--config` to provide your real device and OBS settings. Device entries can also carry the preferred user, @@ -44,6 +45,18 @@ back to a matching tag in the third-party coderus Docker mirror. Neither a configured device label nor mirror tag availability independently establishes the current official SailfishOS release or SDK target. +The Python configuration module is machine-local and intentionally ignored by +Git. Bootstrap a fresh checkout before running, testing, installing, or +packaging it: + +```sh +cp src/sailfish_devel_mcp/config.py.template src/sailfish_devel_mcp/config.py +``` + +Keep machine-specific Python defaults only in the ignored `config.py`. Prefer +the JSON configuration described below for ordinary device, SDK, and build-host +settings. + ## Running From a checkout: diff --git a/src/sailfish_devel_mcp/config.py b/src/sailfish_devel_mcp/config.py.template index 198b09d..198b09d 100644 --- a/src/sailfish_devel_mcp/config.py +++ b/src/sailfish_devel_mcp/config.py.template diff --git a/tests/test_server.py b/tests/test_server.py index 232d411..c5534a1 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -13,6 +13,7 @@ from sailfish_devel_mcp.config import ( AndroidBuildHostConfig, BUNDLED_BUILD_HELPER, Config, + DEFAULT_ANDROID_BUILD_HOST, DEFAULT_ANDROID_BUILD_PROJECT_DIR, DEFAULT_ANDROID_BUILD_SSH_TARGET, DeviceConfig, @@ -250,16 +251,29 @@ class McpServerTests(unittest.TestCase): self.assertIsNone(config.paths.local_sdk) self.assertTrue(config.paths.build_sailfishos.exists()) self.assertNotIn("build-sailfishos-skill", str(config.paths.build_sailfishos)) - self.assertEqual(config.default_android_build_host, "android-builder") + self.assertEqual(config.default_android_build_host, DEFAULT_ANDROID_BUILD_HOST) self.assertEqual( - config.android_build_hosts["android-builder"].ssh_target, + config.android_build_hosts[DEFAULT_ANDROID_BUILD_HOST].ssh_target, DEFAULT_ANDROID_BUILD_SSH_TARGET, ) self.assertEqual( - config.android_build_hosts["android-builder"].project_dir, + config.android_build_hosts[DEFAULT_ANDROID_BUILD_HOST].project_dir, DEFAULT_ANDROID_BUILD_PROJECT_DIR, ) + def test_config_template_contains_only_generic_build_host_defaults(self) -> None: + template = ( + Path(__file__).resolve().parents[1] + / "src" + / "sailfish_devel_mcp" + / "config.py.template" + ).read_text(encoding="utf-8") + self.assertIn('DEFAULT_ANDROID_BUILD_HOST = "android-builder"', template) + self.assertIn( + 'DEFAULT_ANDROID_BUILD_SSH_TARGET = "builder@example.invalid"', + template, + ) + def test_config_loads_local_sdk_from_paths(self) -> None: with tempfile.TemporaryDirectory() as tmp: root = Path(tmp) @@ -1010,7 +1024,7 @@ class McpServerTests(unittest.TestCase): self.assertEqual(response["result"]["structuredContent"]["returncode"], 7) argv = list(mocked_run.call_args.args[0]) self.assertEqual(argv[:3], ["ssh", "-F", str(root / "ssh_config")]) - self.assertIn("builder@example.invalid", argv) + self.assertIn(DEFAULT_ANDROID_BUILD_SSH_TARGET, argv) remote = argv[-1] self.assertIn("tail -n \"$lines\" \"$log_path\"", remote) self.assertIn("lines=25", remote) |
