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.
This commit is contained in:
Bernhard B 2021-03-08 15:19:24 +01:00
parent 4f73de1157
commit c13ac04927
1 changed files with 2 additions and 2 deletions

View File

@ -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: