From a40efa5a5fc8590555f492562be93a18699a1587 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 23 Aug 2020 14:14:50 +0530 Subject: [PATCH] Install Qt source and gettext for POT --- setup/translations.py | 2 +- setup/unix-ci.py | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/setup/translations.py b/setup/translations.py index 6bdcb46708..063aed71a4 100644 --- a/setup/translations.py +++ b/setup/translations.py @@ -18,7 +18,7 @@ is_ci = os.environ.get('CI', '').lower() == 'true' def qt_sources(): - qtdir = '/usr/src/qt5' + qtdir = os.environ.get('QT_SRC', '/usr/src/qt5') j = partial(os.path.join, qtdir) return list(map(j, [ 'qtbase/src/gui/kernel/qplatformtheme.cpp', diff --git a/setup/unix-ci.py b/setup/unix-ci.py index 3c929b18e0..4425d59ede 100644 --- a/setup/unix-ci.py +++ b/setup/unix-ci.py @@ -3,6 +3,7 @@ # License: GPLv3 Copyright: 2017, Kovid Goyal +import glob import os import shlex import subprocess @@ -78,6 +79,7 @@ def download_and_decompress(url, dest, compression=None): ret = subprocess.Popen(['curl', '-fSL', url], stdout=f).wait() if ret == 0: decompress(f.name, dest, compression) + sys.stdout.flush(), sys.stderr.flush() return time.sleep(1) raise SystemExit('Failed to download ' + url) @@ -86,11 +88,19 @@ def download_and_decompress(url, dest, compression=None): def install_calibre_binary(): dest = os.path.expanduser('~/calibre-bin') os.mkdir(dest) - # change this to the canonical download url once 5.0 is released + # change this to the canonical download URL once 5.0 is released download_and_decompress('https://download.calibre-ebook.com/calibre-4.99.12-x86_64.txz', dest, 'J') return os.path.join(dest, 'calibre-debug') +def install_qt_source_code(): + dest = os.path.expanduser('~/qt-base') + os.mkdir(dest) + download_and_decompress('https://download.qt.io/official_releases/qt/5.15/5.15.0/submodules/qtbase-everywhere-src-5.15.0.tar.xz', dest, 'J') + qdir = glob.glob(dest + '/*')[0] + os.environ['QT_SRC'] = qdir + + def run_python(*args): python = os.path.expandvars('$SW/bin/python') if len(args) == 1: @@ -99,6 +109,12 @@ def run_python(*args): return run(*args) +def install_linux_deps(): + run('sudo', 'apt-get', 'update', '-y') + # run('sudo', 'apt-get', 'upgrade', '-y') + run('sudo', 'apt-get', 'install', '-y', 'gettext', 'libgl1-mesa-dev') + + def main(): if iswindows: import runpy @@ -114,9 +130,7 @@ def main(): 'https://download.calibre-ebook.com/ci/calibre3/{}.tar.xz'.format(tball), SW ) if not ismacos: - run('sudo', 'apt-get', 'update', '-y') - # run('sudo', 'apt-get', 'upgrade', '-y') - run('sudo', 'apt-get', 'install', '-y', 'gettext', 'libgl1-mesa-dev') + install_linux_deps() elif action == 'bootstrap': install_env() @@ -132,7 +146,9 @@ username = api '''.replace('PASSWORD', os.environ['tx']) with open(os.path.expanduser('~/.transifexrc'), 'w') as f: f.write(transifexrc) + install_linux_deps() interpreter = install_calibre_binary() + install_qt_source_code() run(interpreter, 'setup.py', 'pot') elif action == 'test':