Install Qt source and gettext for POT

This commit is contained in:
Kovid Goyal 2020-08-23 14:14:50 +05:30
parent 8f15a04d8a
commit a40efa5a5f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 21 additions and 5 deletions

View File

@ -18,7 +18,7 @@ is_ci = os.environ.get('CI', '').lower() == 'true'
def qt_sources(): def qt_sources():
qtdir = '/usr/src/qt5' qtdir = os.environ.get('QT_SRC', '/usr/src/qt5')
j = partial(os.path.join, qtdir) j = partial(os.path.join, qtdir)
return list(map(j, [ return list(map(j, [
'qtbase/src/gui/kernel/qplatformtheme.cpp', 'qtbase/src/gui/kernel/qplatformtheme.cpp',

View File

@ -3,6 +3,7 @@
# License: GPLv3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net> # License: GPLv3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import glob
import os import os
import shlex import shlex
import subprocess import subprocess
@ -78,6 +79,7 @@ def download_and_decompress(url, dest, compression=None):
ret = subprocess.Popen(['curl', '-fSL', url], stdout=f).wait() ret = subprocess.Popen(['curl', '-fSL', url], stdout=f).wait()
if ret == 0: if ret == 0:
decompress(f.name, dest, compression) decompress(f.name, dest, compression)
sys.stdout.flush(), sys.stderr.flush()
return return
time.sleep(1) time.sleep(1)
raise SystemExit('Failed to download ' + url) raise SystemExit('Failed to download ' + url)
@ -86,11 +88,19 @@ def download_and_decompress(url, dest, compression=None):
def install_calibre_binary(): def install_calibre_binary():
dest = os.path.expanduser('~/calibre-bin') dest = os.path.expanduser('~/calibre-bin')
os.mkdir(dest) 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') download_and_decompress('https://download.calibre-ebook.com/calibre-4.99.12-x86_64.txz', dest, 'J')
return os.path.join(dest, 'calibre-debug') 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): def run_python(*args):
python = os.path.expandvars('$SW/bin/python') python = os.path.expandvars('$SW/bin/python')
if len(args) == 1: if len(args) == 1:
@ -99,6 +109,12 @@ def run_python(*args):
return run(*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(): def main():
if iswindows: if iswindows:
import runpy import runpy
@ -114,9 +130,7 @@ def main():
'https://download.calibre-ebook.com/ci/calibre3/{}.tar.xz'.format(tball), SW 'https://download.calibre-ebook.com/ci/calibre3/{}.tar.xz'.format(tball), SW
) )
if not ismacos: if not ismacos:
run('sudo', 'apt-get', 'update', '-y') install_linux_deps()
# run('sudo', 'apt-get', 'upgrade', '-y')
run('sudo', 'apt-get', 'install', '-y', 'gettext', 'libgl1-mesa-dev')
elif action == 'bootstrap': elif action == 'bootstrap':
install_env() install_env()
@ -132,7 +146,9 @@ username = api
'''.replace('PASSWORD', os.environ['tx']) '''.replace('PASSWORD', os.environ['tx'])
with open(os.path.expanduser('~/.transifexrc'), 'w') as f: with open(os.path.expanduser('~/.transifexrc'), 'w') as f:
f.write(transifexrc) f.write(transifexrc)
install_linux_deps()
interpreter = install_calibre_binary() interpreter = install_calibre_binary()
install_qt_source_code()
run(interpreter, 'setup.py', 'pot') run(interpreter, 'setup.py', 'pot')
elif action == 'test': elif action == 'test':