aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command
diff options
context:
space:
mode:
authorHanno Schlichting <hanno@hannosch.eu>2009-07-16 16:57:09 +0200
committerHanno Schlichting <hanno@hannosch.eu>2009-07-16 16:57:09 +0200
commit334f5b69c08cc7b3f60f963a689987412db2e635 (patch)
treedc8a0c6a2f76fa61342d2b33dab6a7277f9a4fec /setuptools/command
parent571fa94fb7c88ebb4028c5890c170e7ad16e3601 (diff)
downloadexternal_python_setuptools-334f5b69c08cc7b3f60f963a689987412db2e635.tar.gz
external_python_setuptools-334f5b69c08cc7b3f60f963a689987412db2e635.tar.bz2
external_python_setuptools-334f5b69c08cc7b3f60f963a689987412db2e635.zip
Apply patch from pjenvey. Closes #3.
--HG-- branch : distribute extra : rebase_source : 3a61d0692c74559b140c179dcc5f4ac4905bb982
Diffstat (limited to 'setuptools/command')
-rwxr-xr-xsetuptools/command/easy_install.py12
-rwxr-xr-xsetuptools/command/egg_info.py1
-rwxr-xr-xsetuptools/command/upload.py4
3 files changed, 13 insertions, 4 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index f06b6ddd..2289b1d5 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -781,7 +781,9 @@ Please make the appropriate changes for your system and try again.
if locals()[name]:
txt = os.path.join(egg_tmp, 'EGG-INFO', name+'.txt')
if not os.path.exists(txt):
- open(txt,'w').write('\n'.join(locals()[name])+'\n')
+ f = open(txt,'w')
+ f.write('\n'.join(locals()[name])+'\n')
+ f.close()
def check_conflicts(self, dist):
"""Verify that there are no conflicting "old-style" packages"""
@@ -1076,7 +1078,9 @@ Please make the appropriate changes for your system and try again.""" % (
if os.path.exists(sitepy):
log.debug("Checking existing site.py in %s", self.install_dir)
- current = open(sitepy,'rb').read()
+ f = open(sitepy,'rb')
+ current = f.read()
+ f.close()
if not current.startswith('def __boot():'):
raise DistutilsError(
"%s is not a setuptools-generated site.py; please"
@@ -1327,7 +1331,8 @@ class PthDistributions(Environment):
saw_import = False
seen = dict.fromkeys(self.sitedirs)
if os.path.isfile(self.filename):
- for line in open(self.filename,'rt'):
+ f = open(self.filename,'rt')
+ for line in f:
if line.startswith('import'):
saw_import = True
continue
@@ -1345,6 +1350,7 @@ class PthDistributions(Environment):
self.dirty = True # we cleaned up, so we're dirty now :)
continue
seen[path] = 1
+ f.close()
if self.paths and not saw_import:
self.dirty = True # ensure anything we touch has import wrappers
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index b14a78b0..a8315d23 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -444,6 +444,7 @@ def get_pkg_info_revision():
match = re.match(r"Version:.*-r(\d+)\s*$", line)
if match:
return int(match.group(1))
+ f.close()
return 0
diff --git a/setuptools/command/upload.py b/setuptools/command/upload.py
index 7ac08c22..1f49745e 100755
--- a/setuptools/command/upload.py
+++ b/setuptools/command/upload.py
@@ -83,7 +83,9 @@ class upload(Command):
dry_run=self.dry_run)
# Fill in the data
- content = open(filename,'rb').read()
+ f = open(filename,'rb')
+ content = f.read()
+ f.close()
basename = os.path.basename(filename)
comment = ''
if command=='bdist_egg' and self.distribution.has_ext_modules():