diff --git a/kigadgets/environment.py b/kigadgets/environment.py index 428e0e7..d41df46 100644 --- a/kigadgets/environment.py +++ b/kigadgets/environment.py @@ -5,6 +5,7 @@ kipython refers to the python executable that ships with KiCad installation """ +import glob import os import sys import argparse @@ -144,6 +145,8 @@ def get_default_paths(): default_locations["pcbnew"] = [ "/usr/lib/python3/dist-packages/pcbnew.py", "/usr/lib/python3/site-packages/pcbnew.py", + # Arch-style: pcbnew installs into the active Python's site-packages + *sorted(glob.glob("/usr/lib/python3.*/site-packages/pcbnew.py"), reverse=True), ] root = os.path.expanduser("~/.config/kicad") default_locations["user"] = [ diff --git a/kigadgets/via.py b/kigadgets/via.py index 480f9e1..ec8bb28 100644 --- a/kigadgets/via.py +++ b/kigadgets/via.py @@ -10,12 +10,15 @@ class ViaType: Through = pcbnew.VIATYPE_THROUGH Micro = pcbnew.VIATYPE_MICROVIA - Blind = pcbnew.VIATYPE_BLIND_BURIED + # KiCad <10 had a combined BLIND_BURIED; KiCad 10+ split it into two. + Blind = getattr(pcbnew, "VIATYPE_BLIND_BURIED", getattr(pcbnew, "VIATYPE_BLIND", None)) + Buried = getattr(pcbnew, "VIATYPE_BURIED", Blind) else: class ViaType: Through = pcbnew.VIA_THROUGH Micro = pcbnew.VIA_MICROVIA Blind = pcbnew.VIA_BLIND_BURIED + Buried = Blind class Via(HasPosition, HasConnection, Selectable, BoardItem):