diff options
author | Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA@GMail.Com> | 2012-12-29 06:23:09 +0100 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA@GMail.Com> | 2012-12-29 06:23:09 +0100 |
commit | 721559fe76a1cda3de639ee2aaa446595169d26b (patch) | |
tree | a33afb83c609e4124c7f78fa79ded12f9f139f8a /setuptools/command | |
parent | 5f6ebc0579291a7dd316e2a64466e688ef7bdb69 (diff) | |
download | external_python_setuptools-721559fe76a1cda3de639ee2aaa446595169d26b.tar.gz external_python_setuptools-721559fe76a1cda3de639ee2aaa446595169d26b.tar.bz2 external_python_setuptools-721559fe76a1cda3de639ee2aaa446595169d26b.zip |
Fix some ResourceWarnings.
--HG--
branch : distribute
extra : rebase_source : 31ac3f0135d8cfe0fabc274f1649d1c99eba2868
Diffstat (limited to 'setuptools/command')
-rwxr-xr-x | setuptools/command/develop.py | 4 | ||||
-rwxr-xr-x | setuptools/command/easy_install.py | 2 | ||||
-rwxr-xr-x | setuptools/command/upload.py | 5 | ||||
-rw-r--r-- | setuptools/command/upload_docs.py | 4 |
4 files changed, 10 insertions, 5 deletions
diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py index 709e349c..1d500040 100755 --- a/setuptools/command/develop.py +++ b/setuptools/command/develop.py @@ -132,7 +132,9 @@ class develop(easy_install): def uninstall_link(self): if os.path.exists(self.egg_link): log.info("Removing %s (link to %s)", self.egg_link, self.egg_base) - contents = [line.rstrip() for line in open(self.egg_link)] + egg_link_file = open(self.egg_link) + contents = [line.rstrip() for line in egg_link_file] + egg_link_file.close() if contents not in ([self.egg_path], [self.egg_path, self.setup_path]): log.warn("Link points to %s: uninstall aborted", contents) return diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index cb911173..0d72f758 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -491,7 +491,7 @@ Please make the appropriate changes for your system and try again. self.cant_write_to_target() else: try: - f.write("import os;open(%r,'w').write('OK')\n" % (ok_file,)) + f.write("import os; f = open(%r, 'w'); f.write('OK'); f.close()\n" % (ok_file,)) f.close(); f=None executable = sys.executable if os.name=='nt': diff --git a/setuptools/command/upload.py b/setuptools/command/upload.py index 9f9366b5..21b9615c 100755 --- a/setuptools/command/upload.py +++ b/setuptools/command/upload.py @@ -109,8 +109,9 @@ class upload(Command): data['comment'] = comment if self.sign: - data['gpg_signature'] = (os.path.basename(filename) + ".asc", - open(filename+".asc").read()) + asc_file = open(filename + ".asc") + data['gpg_signature'] = (os.path.basename(filename) + ".asc", asc_file.read()) + asc_file.close() # set up the authentication auth = "Basic " + base64.encodestring(self.username + ":" + self.password).strip() diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index 98fb7233..1d5a7445 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -105,7 +105,9 @@ class upload_docs(upload): shutil.rmtree(tmp_dir) def upload_file(self, filename): - content = open(filename, 'rb').read() + f = open(filename, 'rb') + content = f.read() + f.close() meta = self.distribution.metadata data = { ':action': 'doc_upload', |