From 7d53272cb1114c48ee093b42947b6dfc569134f0 Mon Sep 17 00:00:00 2001 From: Eugene Mikhantyev Date: Sun, 29 Mar 2026 12:28:27 +0100 Subject: [PATCH] fix: replace hardcoded contributor paths in __main__ blocks Replace /home/chris/... absolute paths with Path(__file__)-relative equivalents in wire_manager.py and pin_locator.py so the test scripts work on any machine. Co-Authored-By: Claude Sonnet 4.6 --- python/commands/pin_locator.py | 10 ++++++---- python/commands/wire_manager.py | 8 +++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/python/commands/pin_locator.py b/python/commands/pin_locator.py index 857c76e..794b5ee 100644 --- a/python/commands/pin_locator.py +++ b/python/commands/pin_locator.py @@ -418,21 +418,23 @@ if __name__ == "__main__": # Test pin location discovery import sys - sys.path.insert(0, "/home/chris/MCP/KiCAD-MCP-Server/python") - from pathlib import Path from commands.component_schematic import ComponentManager from commands.schematic import SchematicManager import shutil + sys.path.insert(0, str(Path(__file__).parent.parent)) + print("=" * 80) print("PIN LOCATOR TEST") print("=" * 80) # Create test schematic with components (cross-platform temp directory) test_path = Path(tempfile.gettempdir()) / "test_pin_locator.kicad_sch" - template_path = Path( - "/home/chris/MCP/KiCAD-MCP-Server/python/templates/template_with_symbols_expanded.kicad_sch" + template_path = ( + Path(__file__).parent.parent + / "templates" + / "template_with_symbols_expanded.kicad_sch" ) shutil.copy(template_path, test_path) diff --git a/python/commands/wire_manager.py b/python/commands/wire_manager.py index 7ef7214..1fba738 100644 --- a/python/commands/wire_manager.py +++ b/python/commands/wire_manager.py @@ -706,20 +706,18 @@ if __name__ == "__main__": # Test wire creation import sys - sys.path.insert(0, "/home/chris/MCP/KiCAD-MCP-Server/python") - from pathlib import Path import shutil + sys.path.insert(0, str(Path(__file__).parent.parent)) + print("=" * 80) print("WIRE MANAGER TEST") print("=" * 80) # Create test schematic (cross-platform temp directory) test_path = Path(tempfile.gettempdir()) / "test_wire_manager.kicad_sch" - template_path = Path( - "/home/chris/MCP/KiCAD-MCP-Server/python/templates/empty.kicad_sch" - ) + template_path = Path(__file__).parent.parent / "templates" / "empty.kicad_sch" shutil.copy(template_path, test_path) print(f"\n✓ Created test schematic: {test_path}")