diff --git a/.scripts/debug_panelize.py b/.scripts/debug_panelize.py new file mode 100644 index 0000000..25d4e03 --- /dev/null +++ b/.scripts/debug_panelize.py @@ -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) diff --git a/configs/default.kibot.yaml b/configs/default.kibot.yaml index 43d8082..ec7d15c 100644 --- a/configs/default.kibot.yaml +++ b/configs/default.kibot.yaml @@ -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 ' diff --git a/configs/mech.kibot.yaml b/configs/mech.kibot.yaml index 8b4e0d0..e2766a3 100644 --- a/configs/mech.kibot.yaml +++ b/configs/mech.kibot.yaml @@ -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' diff --git a/configs/panel.kibot.yaml b/configs/panel.kibot.yaml index 291ba94..ab6add5 100644 --- a/configs/panel.kibot.yaml +++ b/configs/panel.kibot.yaml @@ -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 diff --git a/configs/pcb_main.kibot.yaml b/configs/pcb_main.kibot.yaml index 3d6e619..88cb67b 100644 --- a/configs/pcb_main.kibot.yaml +++ b/configs/pcb_main.kibot.yaml @@ -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' diff --git a/configs/pos.kibot.yaml b/configs/pos.kibot.yaml index 47168d4..b00a3ab 100644 --- a/configs/pos.kibot.yaml +++ b/configs/pos.kibot.yaml @@ -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' diff --git a/configs/sch.kibot.yaml b/configs/sch.kibot.yaml index 799fe67..68ed8c2 100644 --- a/configs/sch.kibot.yaml +++ b/configs/sch.kibot.yaml @@ -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' diff --git a/kibot-ci.yml b/kibot-ci.yml index 87614a8..8998abd 100644 --- a/kibot-ci.yml +++ b/kibot-ci.yml @@ -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" - |