diff --git a/setup/install.py b/setup/install.py index 2ab8caff8e..2be6b54e99 100644 --- a/setup/install.py +++ b/setup/install.py @@ -6,7 +6,6 @@ from __future__ import absolute_import, division, print_function, unicode_litera import atexit import glob -import io import os import shutil import subprocess @@ -16,7 +15,7 @@ import textwrap import time from setup import ( - Command, __appname__, __version__, basenames, download_securely, functions, + Command, __appname__, __version__, basenames, functions, isbsd, ishaiku, islinux, modules ) @@ -356,32 +355,21 @@ class Bootstrap(Command): def pre_sub_commands(self, opts): tdir = self.j(self.d(self.SRC), 'translations') + clone_cmd = [ + 'git', 'clone', 'https://github.com/{}.git'.format(self.TRANSLATIONS_REPO), 'translations'] if opts.ephemeral: if os.path.exists(tdir): shutil.rmtree(tdir) - tarball_url = 'https://api.github.com/repos/{}/tarball'.format(self.TRANSLATIONS_REPO) - import tarfile - self.info('Downloading translations...') st = time.time() - try: - data = download_securely(tarball_url) - except Exception: - time.sleep(1) - data = download_securely(tarball_url) - tarfile.open(fileobj=io.BytesIO(data)).extractall(tdir) - x = os.listdir(tdir)[0] - for y in os.listdir(os.path.join(tdir, x)): - os.rename(os.path.join(tdir, x, y), os.path.join(tdir, y)) - os.rmdir(os.path.join(tdir, x)) + clone_cmd.insert(2, '--depth=1') + subprocess.check_call(clone_cmd, cwd=self.d(self.SRC)) print('Downloaded translations in %d seconds' % int(time.time() - st)) else: if os.path.exists(tdir): subprocess.check_call(['git', 'pull'], cwd=tdir) else: - subprocess.check_call([ - 'git', 'clone', 'https://github.com/{}.git'.format(self.TRANSLATIONS_REPO), - 'translations'], cwd=self.d(self.SRC)) + subprocess.check_call(clone_cmd, cwd=self.d(self.SRC)) def run(self, opts): self.info('\n\nAll done! You should now be able to run "%s setup.py install" to install calibre' % sys.executable)