import struct
import copy
import re
+import operator
if sys.platform == 'mac':
# This module needs work for MacOS9, especially in the area of pathname
next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors)
next.offset = self.offset
- if pax_headers.has_key("size"):
+ if "size" in pax_headers:
# If the extended header replaces the size field,
# we need to recalculate the offset where the next
# header starts.
self.extract(tarinfo, path)
# Reverse sort directories.
- directories.sort(lambda a, b: cmp(a.name, b.name))
+ directories.sort(key=operator.attrgetter('name'))
directories.reverse()
# Set correct owner, mtime and filemode on directories.