Commits

agronholm  committed 46800b6

Fixed Python 3 compatibility issue introduced in #435

  • Participants
  • Parent commits f9b921f
  • Branches 0.6-maintenance

Comments (0)

Files changed (1)

File distribute_setup.py

         self.extract(tarinfo, path)
 
     # Reverse sort directories.
-    def sorter(dir1, dir2):
-        return cmp(dir1.name, dir2.name)
-    directories.sort(sorter)
-    directories.reverse()
+    if sys.version_info < (2, 4):
+        def sorter(dir1, dir2):
+            return cmp(dir1.name, dir2.name)
+        directories.sort(sorter)
+        directories.reverse()
+    else:
+        directories.sort(key=operator.attrgetter('name'), reverse=True)
 
     # Set correct owner, mtime and filemode on directories.
     for tarinfo in directories: