Add ESD9B5.0ST5G, PESD5V0L4UW, TPD2E007DCKR, TPS22994RUKT; fix FSC-BT1058 duplicate library registration

FSC-BT1058 had ended up with two footprint/symbol libraries on disk
(FSC-BT1058 and MIKILAB_FSC-BT1058) after a re-import baked the
"MIKILAB_" nickname prefix into the component name itself. Since that
prefix is normally added automatically when sym-lib-table/fp-lib-table
are generated, the double-prefixed copy (MIKILAB_MIKILAB_FSC_BT1058)
was invisible to collision checks and left the original as a stale,
outdated duplicate.

Consolidated onto the single correct library (symbols/other and
footprints/other without the redundant prefix, matching the rest of
the library's naming convention), fixed the symbol's Footprint
property and the footprint's 3D model reference, and regenerated both
lib-tables from disk.

To stop this class of bug from recurring:
- lib_common.check_component_name() rejects any --name that already
  starts with "MIKILAB", used by import_component.py's import_symbol/
  import_footprint (and therefore also by add_component.py and the
  SnapEDA/UltraLibrarian importers, which call into the same core).
- check_library.py now flags any on-disk symbol/footprint whose name
  already carries that prefix as an ERROR, independent of how it got
  there.
- import_component.py gains --remove to cleanly delete a component
  (symbol, footprint library, 3D model) and regenerate the lib-tables
  in one step, for exactly this kind of cleanup.

Errors: 0 on check_library.py after the fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 20:06:54 +02:00
co-authored by Claude Sonnet 5
parent db364598ad
commit c544db45f4
20 changed files with 33891 additions and 2 deletions
+22
View File
@@ -89,6 +89,28 @@ def norm(value: str) -> str:
return re.sub(r"[^a-zA-Z0-9]+", "_", value).strip("_")
_MIKILAB_PREFIX_RE = re.compile(r"(?i)^mikilab[_\-]?")
def check_component_name(name: str) -> str | None:
"""Every library nickname gets 'MIKILAB_' prepended automatically by
sym_nickname()/fp_nickname() when the lib-tables are generated. A
--name that already starts with 'MIKILAB' therefore does not collide
with the existing component (so it's invisible to duplicate/collision
checks) -- it silently creates a second, double-prefixed orphan
library (e.g. MIKILAB_MIKILAB_FOO) alongside the real one. Returns an
error message if `name` should be rejected, else None."""
if _MIKILAB_PREFIX_RE.match(name):
return (
f"--name '{name}' must not start with 'MIKILAB' -- that prefix is added "
f"automatically to every library nickname when sym-lib-table/fp-lib-table "
f"are generated. Baking it into the component name creates a double-"
f"prefixed, orphaned duplicate library instead of updating the existing "
f"one. Use the bare part name (e.g. 'FOO', not 'MIKILAB_FOO')."
)
return None
def classify(name: str) -> str:
"""Classify a component/library name into a MIKILAB category."""
text = norm(name).lower()