- rev/rev_pcb: Use KIBOT_VAR_rev if set, else git describe - name: Use KIBOT_VAR_name if set, else extract from filename Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
59 lines
1.7 KiB
Python
59 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Debug wrapper for kikit panelize to investigate panel.save() issue"""
|
|
import sys
|
|
import traceback
|
|
import inspect
|
|
|
|
print(f"Arguments: {sys.argv[1:]}", file=sys.stderr)
|
|
|
|
# Parse arguments manually
|
|
input_pcb = None
|
|
output_pcb = None
|
|
preset_file = None
|
|
|
|
args = sys.argv[1:]
|
|
i = 0
|
|
while i < len(args):
|
|
if args[i] == '-p':
|
|
preset_file = args[i+1]
|
|
i += 2
|
|
elif input_pcb is None:
|
|
input_pcb = args[i]
|
|
i += 1
|
|
else:
|
|
output_pcb = args[i]
|
|
i += 1
|
|
|
|
print(f"Input: {input_pcb}", file=sys.stderr)
|
|
print(f"Output: {output_pcb}", file=sys.stderr)
|
|
print(f"Preset: {preset_file}", file=sys.stderr)
|
|
|
|
try:
|
|
from kikit.panelize import Panel
|
|
|
|
# Get the Panel.save method signature and source
|
|
print(f"\nPanel.save signature: {inspect.signature(Panel.save)}", file=sys.stderr)
|
|
|
|
# Look at the source around line 606
|
|
import kikit.panelize as panelize_module
|
|
source_file = inspect.getfile(panelize_module)
|
|
print(f"\nKiKit panelize.py location: {source_file}", file=sys.stderr)
|
|
|
|
# Read the source file - find the save method start
|
|
with open(source_file, 'r') as f:
|
|
lines = f.readlines()
|
|
|
|
# Find the save method definition
|
|
for i, line in enumerate(lines):
|
|
if 'def save(' in line:
|
|
print(f"\nSave method starts at line {i+1}", file=sys.stderr)
|
|
print(f"\nLines {i+1}-{min(i+80, len(lines))} of panelize.py:", file=sys.stderr)
|
|
for j, l in enumerate(lines[i:i+80], start=i+1):
|
|
print(f"{j}: {l.rstrip()}", file=sys.stderr)
|
|
break
|
|
|
|
except Exception as e:
|
|
print("FULL EXCEPTION TRACEBACK:", file=sys.stderr)
|
|
traceback.print_exc()
|
|
sys.exit(1)
|