KiCad 7 Python DRC problems with `lib_footprint_issues` check (incomplete initialization for this new test)
Description
I have the following trivial example PCB:
Just an SMD capacitor. Running pcbnew t1.kicad_pcb
and executing the DRC I get not errors. No need for a project or fp-lib-table. The Capacitor_SMD lib is defined in the global fp-lib-table, which is the default template for KiCad 7.
Running the DRC using the following python code:
import pcbnew
board = pcbnew.LoadBoard('t1.kicad_pcb')
pcbnew.WriteDRCReport(board, 'report.txt', pcbnew.EDA_UNITS_MILLIMETRES, True)
I get:
[lib_footprint_issues]: The current configuration does not include the library 'Capacitor_SMD'.
Local override; Severity: warning
@(128.7500 mm, 54.7500 mm): Footprint REF**
This isn't the case for the GUI. This message seems to be related to the fact that there is no project file. Creating t1.kicad_pro almost empty:
{
}
And running the python code again I get the same error. So now I removed the project and created a local fp-lib-table:
(fp_lib_table
(lib (name Capacitor_SMD)(type KiCad)(uri ${KICAD7_FOOTPRINT_DIR}/Capacitor_SMD.pretty)(options "")(descr ""))
)
Running the script I get the same error. So now I created the silly project again. Now the error is different:
[lib_footprint_issues]: Footprint 'C_0603_1608Metric' not found in library 'Capacitor_SMD'.
Local override; Severity: warning
@(128.7500 mm, 54.7500 mm): Footprint REF**
This error can be fixed adding the following Python code (before pcbnew import):
import os
os.environ['KICAD7_FOOTPRINT_DIR'] = '/usr/share/kicad/footprints'
From what I see:
- You need a project, not needed when using the GUI
- The global fp-lib-table is ignored
- The KICAD7_FOOTPRINT_DIR isn't defined
KiCad Version
Application: KiCad PCB Editor
Version: 7.0.0-rc2-unknown-rc2+208+g52b07b8bac, release build
Libraries:
wxWidgets 3.0.5
FreeType 2.10.4
HarfBuzz 2.7.4
FontConfig 2.13.1
Platform: Debian GNU/Linux 11 (bullseye), 64 bit, Little endian, wxGTK, gnome-xorg, x11
wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.74.0
OCC: 7.5.1
Curl: 7.74.0
ngspice: 34
Compiler: GCC 10.2.1 with C++ ABI 1014
Build settings:
KICAD_SPICE=ON