aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-02-09 15:08:37 -0500
committerJason R. Coombs <jaraco@jaraco.com>2014-02-09 15:08:37 -0500
commit2fbffe9bf4bf6c71c5bbe94e3386d69a2db5f37c (patch)
tree9b97b27a058ccb47864257e9360029086748db46
parent790486c38d8c3912b37ffdc326654de96dc0c862 (diff)
downloadexternal_python_setuptools-2fbffe9bf4bf6c71c5bbe94e3386d69a2db5f37c.tar.gz
external_python_setuptools-2fbffe9bf4bf6c71c5bbe94e3386d69a2db5f37c.tar.bz2
external_python_setuptools-2fbffe9bf4bf6c71c5bbe94e3386d69a2db5f37c.zip
Replace _extractall with the canonical TarFile.extractall.
-rw-r--r--ez_setup.py46
1 files changed, 2 insertions, 44 deletions
diff --git a/ez_setup.py b/ez_setup.py
index 65c92dc6..3e5907dc 100644
--- a/ez_setup.py
+++ b/ez_setup.py
@@ -48,7 +48,7 @@ def _install(tarball, install_args=()):
try:
os.chdir(tmpdir)
tar = tarfile.open(tarball)
- _extractall(tar)
+ tar.extractall()
tar.close()
# going in the directory
@@ -76,7 +76,7 @@ def _build_egg(egg, tarball, to_dir):
try:
os.chdir(tmpdir)
tar = tarfile.open(tarball)
- _extractall(tar)
+ tar.extractall()
tar.close()
# going in the directory
@@ -285,48 +285,6 @@ def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
downloader(url, saveto)
return os.path.realpath(saveto)
-
-def _extractall(self, path=".", members=None):
- """
- Extract all members from the archive to the current working
- directory and set owner, modification time and permissions on
- directories afterwards. `path' specifies a different directory
- to extract to. `members' is optional and must be a subset of the
- list returned by getmembers().
- """
- import copy
- import operator
- from tarfile import ExtractError
- directories = []
-
- if members is None:
- members = self
-
- for tarinfo in members:
- if tarinfo.isdir():
- # Extract directories with a safe mode.
- directories.append(tarinfo)
- tarinfo = copy.copy(tarinfo)
- tarinfo.mode = 448 # decimal for oct 0700
- self.extract(tarinfo, path)
-
- # Reverse sort directories.
- directories.sort(key=operator.attrgetter('name'), reverse=True)
-
- # Set correct owner, mtime and filemode on directories.
- for tarinfo in directories:
- dirpath = os.path.join(path, tarinfo.name)
- try:
- self.chown(tarinfo, dirpath)
- self.utime(tarinfo, dirpath)
- self.chmod(tarinfo, dirpath)
- except ExtractError as e:
- if self.errorlevel > 1:
- raise
- else:
- self._dbg(1, "tarfile: %s" % e)
-
-
def _build_install_args(options):
"""
Build the arguments to 'python setup.py install' on the setuptools package