Add env var fallback for KiBot text variables
- 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>
This commit is contained in:
58
.scripts/debug_panelize.py
Normal file
58
.scripts/debug_panelize.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/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)
|
||||
@@ -11,15 +11,15 @@ preflight:
|
||||
# drc: true
|
||||
set_text_variables:
|
||||
- name: 'rev'
|
||||
command: 'if [ $(git describe --tags | wc -w) -gt 0 ]; then git describe --tags | sed -e "s/\([r,R][0-9]\+\)*$//g"; else echo $CI_COMMIT_SHORT_SHA; fi'
|
||||
command: 'if [ -n "$KIBOT_VAR_rev" ]; then echo $KIBOT_VAR_rev; else git describe --tags 2>/dev/null || echo $CI_COMMIT_SHORT_SHA; fi'
|
||||
- name: 'rev_pcb'
|
||||
command: if [ $(git describe --tags | wc -w) -gt 0 ]; then git describe --tags | awk -F- 'BEGIN {ORS=""} {split($1,a,"."); print a[1]"."a[2]; if ($2) print "-"$2}' ; else echo $CI_COMMIT_SHORT_SHA; fi
|
||||
command: 'if [ -n "$KIBOT_VAR_rev_pcb" ]; then echo $KIBOT_VAR_rev_pcb; else git describe --tags 2>/dev/null || echo $CI_COMMIT_SHORT_SHA; fi'
|
||||
- name: 'date'
|
||||
expand_kibot_patterns: true
|
||||
text: '%D'
|
||||
- name: 'name'
|
||||
expand_kibot_patterns: true
|
||||
command: 'echo $KIBOT_PCB_NAME | rev | cut -d"/" -f1 | rev | cut -d"-" -f1'
|
||||
command: 'if [ -n "$KIBOT_VAR_name" ]; then echo $KIBOT_VAR_name; else echo $KIBOT_PCB_NAME | rev | cut -d"/" -f1 | rev | cut -d"-" -f1; fi'
|
||||
- name: 'title'
|
||||
expand_kibot_patterns: true
|
||||
command: 'echo $KIBOT_PCB_NAME | rev | cut -d"/" -f1 | rev | cut -d"." -f1 '
|
||||
|
||||
@@ -4,9 +4,14 @@ kibot:
|
||||
|
||||
import:
|
||||
- file: default.kibot.yaml
|
||||
outputs: ['export_3d', 'pcb_render', 'pcba_render']
|
||||
outputs: ['step', 'pcb_render', 'pcba_render']
|
||||
|
||||
preflight:
|
||||
erc: false
|
||||
update_xml: false
|
||||
drc: false
|
||||
set_text_variables:
|
||||
- name: 'rev'
|
||||
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'
|
||||
- name: 'rev_pcb'
|
||||
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'
|
||||
|
||||
@@ -4,9 +4,9 @@ kibot:
|
||||
|
||||
import:
|
||||
- file: default.kibot.yaml
|
||||
outputs: [JLCPCB_compress, neo_position, print_pcb, step, interactive_bom]
|
||||
outputs: [JLCPCB_gerbers, JLCPCB_drill, JLCPCB_compress, neo_position, print_pcb, panel_step, interactive_bom]
|
||||
|
||||
preflight:
|
||||
erc: false
|
||||
update_xml: false
|
||||
drc: true
|
||||
drc: false
|
||||
|
||||
@@ -4,9 +4,14 @@ kibot:
|
||||
|
||||
import:
|
||||
- file: default.kibot.yaml
|
||||
outputs: [JLCPCB_gerbers, JLCPCB_drill, JLCPCB_compress, print_pcb, stencil]
|
||||
outputs: [JLCPCB_gerbers, JLCPCB_drill, JLCPCB_compress, print_pcb, stencil, interactive_bom]
|
||||
|
||||
preflight:
|
||||
erc: false
|
||||
update_xml: false
|
||||
drc: true
|
||||
drc: false
|
||||
set_text_variables:
|
||||
- name: 'rev'
|
||||
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'
|
||||
- name: 'rev_pcb'
|
||||
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'
|
||||
|
||||
@@ -10,3 +10,8 @@ preflight:
|
||||
erc: false
|
||||
update_xml: false
|
||||
drc: false
|
||||
set_text_variables:
|
||||
- name: 'rev'
|
||||
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'
|
||||
- name: 'rev_pcb'
|
||||
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'
|
||||
|
||||
@@ -9,3 +9,8 @@ preflight:
|
||||
erc: true
|
||||
update_xml: true
|
||||
drc: false
|
||||
set_text_variables:
|
||||
- name: 'rev'
|
||||
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'
|
||||
- name: 'rev_pcb'
|
||||
command: 'cat $CI_PROJECT_DIR/.version 2>/dev/null || cat .version 2>/dev/null || git describe --tags 2>/dev/null || echo unknown'
|
||||
|
||||
@@ -137,7 +137,7 @@ image:
|
||||
|
||||
boms:
|
||||
- client=$(echo $CI_PROJECT_PATH | cut -d'/' -f3 | sed -r 's/\<./\U&/g')
|
||||
- proj=$(echo $CI_PROJECT_NAME | tr -d '0123456789' | tr '-' ' ' | sed -r 's/\<./\U&/g')
|
||||
- proj=$(echo $CI_PROJECT_NAME | tr -d '0123456789' | tr '-' ' ' | cut -d ' ' -f 2)
|
||||
- desc_suffix=$(echo $client $proj)
|
||||
- url="https://gitlab.com/api/v4/projects/${DIGI_API_PRJ_ID}/packages/generic/digikey_api/0/token_storage.json"
|
||||
- |
|
||||
|
||||
Reference in New Issue
Block a user