aboutsummaryrefslogtreecommitdiff
path: root/tools/kicad_env.sh
diff options
context:
space:
mode:
authorLouis <louis@dnge.de>2026-11-11 10:08:41 +0100
committerLouis <louis@dnge.de>2026-11-11 10:08:41 +0100
commit2e433fcd0d1afadd8ab786dd30d7d4546bdee43d (patch)
treef2a5603703d56b08c1eaa672eaf529ec4b2cc3fa /tools/kicad_env.sh
downloadhw-toolchain-2e433fcd0d1afadd8ab786dd30d7d4546bdee43d.tar.gz
hw-toolchain: placer, routers and KiCad helpers for agent-driven hardware work
Rust placer (simulated annealing) and negotiated-congestion router for 2-layer KiCad boards, pnr.sh to place, route, DRC-check and install candidates, Python KiCad helpers, repo conventions (AGENTS.md) and the tool documentation under knowledge/. Konnect (KiCad MCP, AGPL) as a submodule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/kicad_env.sh')
-rw-r--r--tools/kicad_env.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/kicad_env.sh b/tools/kicad_env.sh
new file mode 100644
index 0000000..f4947f0
--- /dev/null
+++ b/tools/kicad_env.sh
@@ -0,0 +1,22 @@
+# Sourced by the shell scripts in tools/: sets KPY (a Python that can `import pcbnew`) and
+# KC (kicad-cli). Set either in the environment to override the detection.
+#
+# KICAD_PYTHON=/usr/bin/python3 KICAD_CLI=/usr/bin/kicad-cli sh tools/pnr.sh run board_dir
+
+_mac=/Applications/KiCad/KiCad.app/Contents
+if [ -z "$KICAD_PYTHON" ]; then
+ if [ -x "$_mac/Frameworks/Python.framework/Versions/Current/bin/python3" ]; then
+ KICAD_PYTHON=$_mac/Frameworks/Python.framework/Versions/Current/bin/python3
+ elif [ -x "$_mac/Frameworks/Python.framework/Versions/3.9/bin/python3" ]; then
+ KICAD_PYTHON=$_mac/Frameworks/Python.framework/Versions/3.9/bin/python3
+ else
+ KICAD_PYTHON=python3 # Linux: the system Python has pcbnew when KiCad is installed from packages
+ fi
+fi
+if [ -z "$KICAD_CLI" ]; then
+ if command -v kicad-cli >/dev/null 2>&1; then KICAD_CLI=kicad-cli
+ else KICAD_CLI=$_mac/MacOS/kicad-cli; fi
+fi
+KPY=$KICAD_PYTHON
+KC=$KICAD_CLI
+export KPY KC