Commit 531bb6a1 authored by Xavier Thompson's avatar Xavier Thompson

Support installing setuptools from .tar.gz

In addition to already supported .zip archives
parent 74b18622
import os, sys
import errno, os, sys
class FakeSysExecutable(object):
......@@ -36,15 +36,21 @@ def setup_script(path, python=sys.executable):
easy_install.sys = sys
def main():
import shutil, subprocess, tempfile, zipfile
import shutil, subprocess, tarfile, tempfile, zipfile
eggs_dir = sys.argv[2]
cache = sys.argv[3]
base = os.path.join(cache, sys.argv[4].replace('==', '-'))
# Install setuptools.
src = os.path.join(cache, sys.argv[4].replace('==', '-') + '.zip')
tmp = tempfile.mkdtemp()
try:
with zipfile.ZipFile(src) as zip_file:
zip_file.extractall(tmp)
try:
with zipfile.ZipFile(base + '.zip') as zip_file:
zip_file.extractall(tmp)
except IOError as e:
if e.errno != errno.ENOENT:
raise
with tarfile.open(base + '.tar.gz') as tar_file:
tar_file.extractall(tmp)
src, = os.listdir(tmp)
subprocess.check_call((sys.executable, 'setup.py', '-q', 'bdist_egg',
'--dist-dir', tmp), cwd=os.path.join(tmp, src))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment