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 | 429eed215479c1044254b0f6ac03abbd767a4dea (patch) | |
| tree | 26cd3f402f204e2d81d43bb4a50a3ca7e3dd870d /setuptools/command | |
| parent | 1d4c9d45d387d0cce7e67fdbab5a9a5ff71c47f5 (diff) | |
| download | python-setuptools-bitbucket-429eed215479c1044254b0f6ac03abbd767a4dea.tar.gz | |
Use context manager for opening file
Diffstat (limited to 'setuptools/command')
| -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): |
