Better fixes for publish pipeline issues

This commit is contained in:
Kovid Goyal 2019-10-04 07:35:09 +05:30
parent b698e78547
commit 749460cbfc
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 40 additions and 41 deletions

View File

@ -19,13 +19,8 @@ class Stage1(Command):
description = 'Stage 1 of the publish process' description = 'Stage 1 of the publish process'
sub_commands = [ sub_commands = [
'check',
'test',
'cacerts', 'cacerts',
# 'pot',
'build',
'resources', 'resources',
# 'translations',
'iso639', 'iso639',
'iso3166', 'iso3166',
'gui', 'gui',
@ -56,14 +51,10 @@ class Stage2(Command):
session.append('title ' + x) session.append('title ' + x)
session.append('launch ' + cmd) session.append('launch ' + cmd)
env = os.environ.copy()
if 'DISPLAY' not in env:
env['DISPLAY'] = ':0'
p = subprocess.Popen([ p = subprocess.Popen([
'kitty', '-o', 'enabled_layouts=vertical,stack', '-o', 'scrollback_lines=20000', 'kitty', '-o', 'enabled_layouts=vertical,stack', '-o', 'scrollback_lines=20000',
'-o', 'close_on_child_death=y', '--session=-' '-o', 'close_on_child_death=y', '--session=-'
], stdin=subprocess.PIPE, env=env) ], stdin=subprocess.PIPE)
p.communicate('\n'.join(session).encode('utf-8')) p.communicate('\n'.join(session).encode('utf-8'))
p.wait() p.wait()
@ -112,7 +103,11 @@ class Publish(Command):
require_git_master() require_git_master()
require_clean_git() require_clean_git()
if 'PUBLISH_BUILD_DONE' not in os.environ: if 'PUBLISH_BUILD_DONE' not in os.environ:
subprocess.check_call([sys.executable, 'setup.py', 'check'])
subprocess.check_call([sys.executable, 'setup.py', 'build']) subprocess.check_call([sys.executable, 'setup.py', 'build'])
subprocess.check_call([sys.executable, 'setup.py', 'test'])
subprocess.check_call([sys.executable, 'setup.py', 'pot'])
subprocess.check_call([sys.executable, 'setup.py', 'translations'])
os.environ['PUBLISH_BUILD_DONE'] = '1' os.environ['PUBLISH_BUILD_DONE'] = '1'
os.execl(os.path.abspath('setup.py'), './setup.py', 'publish') os.execl(os.path.abspath('setup.py'), './setup.py', 'publish')

View File

@ -204,40 +204,44 @@ class BuildTest(unittest.TestCase):
test() test()
from calibre.gui2 import ensure_app, destroy_app from calibre.gui2 import ensure_app, destroy_app
os.environ.pop('DISPLAY', None) display_env_var = os.environ.pop('DISPLAY', None)
ensure_app() try:
self.assertGreaterEqual(len(QFontDatabase().families()), 5, 'The QPA headless plugin is not able to locate enough system fonts via fontconfig') ensure_app()
from calibre.ebooks.covers import create_cover self.assertGreaterEqual(len(QFontDatabase().families()), 5, 'The QPA headless plugin is not able to locate enough system fonts via fontconfig')
create_cover('xxx', ['yyy']) from calibre.ebooks.covers import create_cover
na = QNetworkAccessManager() create_cover('xxx', ['yyy'])
self.assertTrue(hasattr(na, 'sslErrors'), 'Qt not compiled with openssl') na = QNetworkAccessManager()
if iswindows: self.assertTrue(hasattr(na, 'sslErrors'), 'Qt not compiled with openssl')
from PyQt5.Qt import QtWin if iswindows:
QtWin from PyQt5.Qt import QtWin
p = QWebEnginePage() QtWin
p = QWebEnginePage()
def callback(result): def callback(result):
callback.result = result callback.result = result
if hasattr(print_callback, 'result'): if hasattr(print_callback, 'result'):
QApplication.instance().quit() QApplication.instance().quit()
def print_callback(result): def print_callback(result):
print_callback.result = result print_callback.result = result
if hasattr(callback, 'result'): if hasattr(callback, 'result'):
QApplication.instance().quit() QApplication.instance().quit()
p.runJavaScript('1 + 1', callback) p.runJavaScript('1 + 1', callback)
p.printToPdf(print_callback) p.printToPdf(print_callback)
QTimer.singleShot(5000, lambda: QApplication.instance().quit()) QTimer.singleShot(5000, lambda: QApplication.instance().quit())
QApplication.instance().exec_() QApplication.instance().exec_()
test_flaky = isosx and not is_ci test_flaky = isosx and not is_ci
if not test_flaky: if not test_flaky:
self.assertEqual(callback.result, 2, 'Simple JS computation failed') self.assertEqual(callback.result, 2, 'Simple JS computation failed')
self.assertIn(b'Skia/PDF', bytes(print_callback.result), 'Print to PDF failed') self.assertIn(b'Skia/PDF', bytes(print_callback.result), 'Print to PDF failed')
del p del p
del na del na
destroy_app() destroy_app()
del QWebEnginePage del QWebEnginePage
finally:
if display_env_var is not None:
os.environ['DISPLAY'] = display_env_var
def test_imaging(self): def test_imaging(self):
from PIL import Image from PIL import Image