From b5991f0555161e7baf665822dac54d493209dae2 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Sun, 25 Dec 2011 23:55:59 +0000 Subject: [PATCH] extract-profile.in: Allow empty sections. Organization: Straylight/Edgeware From: Mark Wooding Create a section as soon as we see a section header; we no longer need the more complicated lazy creation code. --- extract-profile.in | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/extract-profile.in b/extract-profile.in index dc816f3..918da8c 100755 --- a/extract-profile.in +++ b/extract-profile.in @@ -376,6 +376,8 @@ def parse(filename, d): continue if line[0] == '[' and line[-1] == ']': sect = line[1:-1] + if sect not in d: + d[sect] = Section(sect) continue ## Parse an assignment. @@ -393,12 +395,7 @@ def parse(filename, d): raise UserError, "%s:%d: bad name `%s'" % (filename, n, name) ## Store the assignment. - try: - d[sect][name] = value - except KeyError: - s = Section(sect) - d[sect] = s - s[name] = value + d[sect][name] = value ###-------------------------------------------------------------------------- ### Main program. -- [mdw]