Commit 9f48d842 authored by Jason R. Coombs's avatar Jason R. Coombs

Use context manager for opening and closing the file

parent 24978070
......@@ -86,7 +86,6 @@ class install_egg_info(Command):
if self.dry_run:
return
f = open(filename, 'wt')
for pkg in nsp:
# ensure pkg is not a unicode string under Python 2.7
pkg = str(pkg)
......@@ -96,8 +95,9 @@ class install_egg_info(Command):
if parent:
tmpl_lines += self._nspkg_tmpl_multi
dat = ';'.join(tmpl_lines) % locals() + '\n'
with open(filename, 'wt') as f:
f.write(dat)
f.close()
def _get_all_ns_packages(self):
"""Return sorted list of all package namespaces"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment