aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/upload.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/command/upload.py')
-rwxr-xr-xsetuptools/command/upload.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/setuptools/command/upload.py b/setuptools/command/upload.py
index 7ac08c22..21b9615c 100755
--- a/setuptools/command/upload.py
+++ b/setuptools/command/upload.py
@@ -83,14 +83,16 @@ 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():
comment = "built on %s" % platform.platform(terse=1)
data = {
':action':'file_upload',
- 'protcol_version':'1',
+ 'protocol_version':'1',
'name':self.distribution.get_name(),
'version':self.distribution.get_version(),
'content':(basename,content),
@@ -107,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()
@@ -179,3 +182,4 @@ class upload(Command):
log.ERROR)
if self.show_response:
print '-'*75, r.read(), '-'*75
+