summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-01-16 10:41:47 -0500
committerJason R. Coombs <jaraco@jaraco.com>2016-01-16 10:41:47 -0500
commit6e868bef8b855ef13150eb0b928b40afb151485e (patch)
tree3a41b0c98e5738ec16d9ac758b05f0884039f5de
parent397a97c9ce15f97d075972577678b03664beb83a (diff)
downloadpython-setuptools-bitbucket-6e868bef8b855ef13150eb0b928b40afb151485e.tar.gz
Fix two failures in sorting where filename parts became a factor in the version. Ref #432.
-rw-r--r--scripts/upload-old-releases-as-zip.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/upload-old-releases-as-zip.py b/scripts/upload-old-releases-as-zip.py
index 38cfcd55..d718e3bb 100644
--- a/scripts/upload-old-releases-as-zip.py
+++ b/scripts/upload-old-releases-as-zip.py
@@ -195,11 +195,19 @@ class SetuptoolsOldReleasesWithoutZip:
if e.errno != errno.EEXIST:
raise e
+ @staticmethod
+ def version_from_filename(filename):
+ basename = os.path.basename(filename)
+ name, ext = os.path.splitext(basename)
+ if name.endswith('.tar'):
+ name, ext2 = os.path.splitext(name)
+ return LooseVersion(name)
+
def convert_targz_to_zip(self):
print("Converting the tar.gz to zip...")
files = glob.glob('%s/*.tar.gz' % self.dirpath)
total_converted = 0
- for targz in sorted(files, key=LooseVersion):
+ for targz in sorted(files, key=self.version_from_filename):
# Extract and remove tar.
tar = tarfile.open(targz)
tar.extractall(path=self.dirpath)
@@ -230,8 +238,7 @@ class SetuptoolsOldReleasesWithoutZip:
def upload_zips_to_pypi(self):
print('Uploading to pypi...')
- zips = sorted(glob.glob('%s/*.zip' % self.dirpath), key=LooseVersion)
- print("simulated upload of", zips); return
+ zips = sorted(glob.glob('%s/*.zip' % self.dirpath), key=self.version_from_filename)
upload.upload(dists=zips)