From c13ac049277f5a1643508ab19aada2ea42137236 Mon Sep 17 00:00:00 2001 From: Bernhard B Date: Mon, 8 Mar 2021 15:19:24 +0100 Subject: [PATCH] be more tolerant when parsing libraries Some SnapEDA libraries (e.g https://www.snapeda.com/parts/TS3A27518EPWR/Texas%20Instruments/view-part) use the token "# End Library" instead of "#End Library" to mark the end of the library. --- kibot/kicad/v5_sch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kibot/kicad/v5_sch.py b/kibot/kicad/v5_sch.py index ed9f7f72..a08a66c0 100644 --- a/kibot/kicad/v5_sch.py +++ b/kibot/kicad/v5_sch.py @@ -69,7 +69,7 @@ class LibLineReader(LineReader): def get_line(self): res = self.f.readline() while res and res[0] == '#': - if res.startswith('#End Library'): + if res.startswith('#End Library') or res.startswith('# End Library'): return res.rstrip() self.line += 1 res = self.f.readline() @@ -635,7 +635,7 @@ class SymLib(object): if not line.startswith('EESchema-LIBRARY'): raise SchLibError('Missing library signature', line, f) line = f.get_line() - while not line.startswith('#End Library'): + while not (line.startswith('#End Library') or line.startswith('# End Library')): if line.startswith('DEF'): o = LibComponent(line, f, file) if o.name: