fix: Address critical Windows compatibility and JLCPCB issues (#36, #37, #35)

Phase 1 critical fixes addressing three high-priority issues:

Issue #36 - Windows IPC backend crash (os.getuid not available):
- Add platform detection to skip Unix-specific socket paths on Windows
- Use hasattr check before calling os.getuid()
- Windows now uses auto-detect fallback (named pipes)
- Maintains full Unix socket support on Linux/macOS

Issue #37 - Windows schematic file creation broken:
- Generate unique UUIDs instead of invalid all-zeros UUID
- Add explicit UTF-8 encoding for cross-platform compatibility
- Force Unix line endings (LF) to prevent Windows CRLF issues
- Update template file with valid placeholder UUID
- Fix hardcoded /tmp/ paths in wire_manager.py and pin_locator.py

Issue #35 - JLCPCB download limited to 100 parts:
- Change batch_size from 1000 to 100 to match tscircuit API limit
- Remove premature loop termination when batch < batch_size
- Add documentation explaining API limitation
- Expected result: Full ~2.5M part catalog download (40-60 minutes)

All changes maintain backward compatibility and include detailed comments.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
KiCAD MCP Bot
2026-02-26 10:03:20 -05:00
parent b9bd401b11
commit b4d114ac74
6 changed files with 33 additions and 19 deletions

View File

@@ -15,6 +15,7 @@ Key Benefits over SWIG:
"""
import logging
import os
import platform
from pathlib import Path
from typing import Optional, Dict, Any, List, Callable
@@ -74,12 +75,16 @@ class IPCBackend(KiCADBackend):
if socket_path:
socket_paths_to_try.append(socket_path)
else:
# Common socket locations
socket_paths_to_try = [
'ipc:///tmp/kicad/api.sock', # Linux default
f'ipc:///run/user/{os.getuid()}/kicad/api.sock', # XDG runtime
None # Let kipy auto-detect
]
# Common socket locations (Unix-like systems only)
# Windows uses named pipes, handled by auto-detect
if platform.system() != "Windows":
socket_paths_to_try.append('ipc:///tmp/kicad/api.sock') # Linux default
# XDG runtime directory (requires getuid, Unix only)
if hasattr(os, 'getuid'):
socket_paths_to_try.append(f'ipc:///run/user/{os.getuid()}/kicad/api.sock')
# Auto-detect for all platforms (Windows uses named pipes, Unix uses sockets)
socket_paths_to_try.append(None)
last_error = None
for path in socket_paths_to_try: