From da67895fef68ca520c21977dd60601d306e6eebe Mon Sep 17 00:00:00 2001 From: Jeff Connelly Date: Fri, 16 May 2008 19:53:45 -0700 Subject: [PATCH] =?utf8?q?PADS-PCB=20Merging=20Tool:=20allow=20blank=20lin?= =?utf8?q?es,=20=E2=89=A50=20comments=20before=20*PARTS*.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Needed to be compatible with the format FreePCB exports, not just the format bb.py generates. --- bb/mergepads.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/bb/mergepads.py b/bb/mergepads.py index 346834c..ff9e9ca 100644 --- a/bb/mergepads.py +++ b/bb/mergepads.py @@ -14,12 +14,15 @@ def load_pads(f): print "not PADS-PCB format, first line: %s" % (l,) raise SystemExit - l = f.readline() - - l = f.readline().strip() - if l != "*PART*": - print "expected *PARTS*, got %s" % (l,) - raise SystemExit + # Read comments until parts section + while True: + l = f.readline() + if len(l) == 0: + print "unexpected end-of-file before parts section" + raise SystemExit + if l.strip() == "*PART*": + # got it + break # Read all parts until *NET* parts = {} @@ -31,6 +34,10 @@ def load_pads(f): break part = part.strip() + if len(part) == 0: # (stripped) + # whitespace + continue + if part == "*NET*": break name, package = part.split() -- 2.11.4.GIT