summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorRussell Bryant <russell@ovn.org>2015-12-10 14:22:58 -0500
committerRussell Bryant <russell@ovn.org>2015-12-11 12:02:23 -0500
commit069390bb36763abff90d66afb8effee09482966c (patch)
treec6c4b2d23957db2130ade773cfe84b9dc5cd28f1 /build-aux
parent138bc37a3a4cd1e4e0d9f3d2b1c27d23a7ccf454 (diff)
downloadopenvswitch-069390bb36763abff90d66afb8effee09482966c.tar.gz
xml2nroff: Read whole file instead of line by line.
The previous code processed the input file line by line, but I think it looks a little more straight forward to just process the whole file at once. This patch also explicitly closes the file after reading its contents. Signed-off-by: Russell Bryant <russell@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/xml2nroff12
1 files changed, 5 insertions, 7 deletions
diff --git a/build-aux/xml2nroff b/build-aux/xml2nroff
index d55a0d313..00ef649f1 100755
--- a/build-aux/xml2nroff
+++ b/build-aux/xml2nroff
@@ -41,13 +41,11 @@ The following options are also available:
def manpage_to_nroff(xml_file, subst, version=None):
- f = open(xml_file)
- content = []
- for line in f:
- for k, v in subst.iteritems():
- line = line.replace(k, v)
- content += [line]
- doc = xml.dom.minidom.parseString(''.join(content)).documentElement
+ with open(xml_file) as f:
+ content = f.read()
+ for k, v in subst.iteritems():
+ content = content.replace(k, v)
+ doc = xml.dom.minidom.parseString(content).documentElement
if version is None:
version = "UNKNOWN"