diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-01 21:59:33 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-01 21:59:33 -0500 |
commit | 98ea00965bed70ccf57eb58394d15739fb7372ab (patch) | |
tree | b70725acc9f638997dda9c12a65c963d48851fd6 /setuptools/command/easy_install.py | |
parent | dadd14d82c5f1db83704eb1c6da0b62998cb25a7 (diff) | |
download | external_python_setuptools-98ea00965bed70ccf57eb58394d15739fb7372ab.tar.gz external_python_setuptools-98ea00965bed70ccf57eb58394d15739fb7372ab.tar.bz2 external_python_setuptools-98ea00965bed70ccf57eb58394d15739fb7372ab.zip |
Use context manager for opening file
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-x | setuptools/command/easy_install.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 9e9c5e54..547a8842 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -805,9 +805,8 @@ class easy_install(Command): ensure_directory(target) if os.path.exists(target): os.unlink(target) - f = open(target, "w" + mode) - f.write(contents) - f.close() + with open(target, "w" + mode) as f: + f.write(contents) chmod(target, 0o777 - mask) def install_eggs(self, spec, dist_filename, tmpdir): |