diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-06-22 10:13:38 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-06-22 10:13:38 -0400 |
commit | 9f48d842e5c7c916f472420c7bc9f62b333a40ff (patch) | |
tree | 0acaa97d08901c5bdad8fed6e687ce2ca05b9b0b /setuptools/command/install_egg_info.py | |
parent | 24978070e68c58dfd787b93d6f1e0a35f6871c52 (diff) | |
download | external_python_setuptools-9f48d842e5c7c916f472420c7bc9f62b333a40ff.tar.gz external_python_setuptools-9f48d842e5c7c916f472420c7bc9f62b333a40ff.tar.bz2 external_python_setuptools-9f48d842e5c7c916f472420c7bc9f62b333a40ff.zip |
Use context manager for opening and closing the file
Diffstat (limited to 'setuptools/command/install_egg_info.py')
-rwxr-xr-x | setuptools/command/install_egg_info.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/setuptools/command/install_egg_info.py b/setuptools/command/install_egg_info.py index 6aba68be..87cfc490 100755 --- a/setuptools/command/install_egg_info.py +++ b/setuptools/command/install_egg_info.py @@ -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""" |