mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Better fixes for publish pipeline issues
This commit is contained in:
parent
b698e78547
commit
749460cbfc
@ -19,13 +19,8 @@ class Stage1(Command):
|
||||
description = 'Stage 1 of the publish process'
|
||||
|
||||
sub_commands = [
|
||||
'check',
|
||||
'test',
|
||||
'cacerts',
|
||||
# 'pot',
|
||||
'build',
|
||||
'resources',
|
||||
# 'translations',
|
||||
'iso639',
|
||||
'iso3166',
|
||||
'gui',
|
||||
@ -56,14 +51,10 @@ class Stage2(Command):
|
||||
session.append('title ' + x)
|
||||
session.append('launch ' + cmd)
|
||||
|
||||
env = os.environ.copy()
|
||||
if 'DISPLAY' not in env:
|
||||
env['DISPLAY'] = ':0'
|
||||
|
||||
p = subprocess.Popen([
|
||||
'kitty', '-o', 'enabled_layouts=vertical,stack', '-o', 'scrollback_lines=20000',
|
||||
'-o', 'close_on_child_death=y', '--session=-'
|
||||
], stdin=subprocess.PIPE, env=env)
|
||||
], stdin=subprocess.PIPE)
|
||||
|
||||
p.communicate('\n'.join(session).encode('utf-8'))
|
||||
p.wait()
|
||||
@ -112,7 +103,11 @@ class Publish(Command):
|
||||
require_git_master()
|
||||
require_clean_git()
|
||||
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', 'test'])
|
||||
subprocess.check_call([sys.executable, 'setup.py', 'pot'])
|
||||
subprocess.check_call([sys.executable, 'setup.py', 'translations'])
|
||||
os.environ['PUBLISH_BUILD_DONE'] = '1'
|
||||
os.execl(os.path.abspath('setup.py'), './setup.py', 'publish')
|
||||
|
||||
|
@ -204,40 +204,44 @@ class BuildTest(unittest.TestCase):
|
||||
test()
|
||||
|
||||
from calibre.gui2 import ensure_app, destroy_app
|
||||
os.environ.pop('DISPLAY', None)
|
||||
ensure_app()
|
||||
self.assertGreaterEqual(len(QFontDatabase().families()), 5, 'The QPA headless plugin is not able to locate enough system fonts via fontconfig')
|
||||
from calibre.ebooks.covers import create_cover
|
||||
create_cover('xxx', ['yyy'])
|
||||
na = QNetworkAccessManager()
|
||||
self.assertTrue(hasattr(na, 'sslErrors'), 'Qt not compiled with openssl')
|
||||
if iswindows:
|
||||
from PyQt5.Qt import QtWin
|
||||
QtWin
|
||||
p = QWebEnginePage()
|
||||
display_env_var = os.environ.pop('DISPLAY', None)
|
||||
try:
|
||||
ensure_app()
|
||||
self.assertGreaterEqual(len(QFontDatabase().families()), 5, 'The QPA headless plugin is not able to locate enough system fonts via fontconfig')
|
||||
from calibre.ebooks.covers import create_cover
|
||||
create_cover('xxx', ['yyy'])
|
||||
na = QNetworkAccessManager()
|
||||
self.assertTrue(hasattr(na, 'sslErrors'), 'Qt not compiled with openssl')
|
||||
if iswindows:
|
||||
from PyQt5.Qt import QtWin
|
||||
QtWin
|
||||
p = QWebEnginePage()
|
||||
|
||||
def callback(result):
|
||||
callback.result = result
|
||||
if hasattr(print_callback, 'result'):
|
||||
QApplication.instance().quit()
|
||||
def callback(result):
|
||||
callback.result = result
|
||||
if hasattr(print_callback, 'result'):
|
||||
QApplication.instance().quit()
|
||||
|
||||
def print_callback(result):
|
||||
print_callback.result = result
|
||||
if hasattr(callback, 'result'):
|
||||
QApplication.instance().quit()
|
||||
def print_callback(result):
|
||||
print_callback.result = result
|
||||
if hasattr(callback, 'result'):
|
||||
QApplication.instance().quit()
|
||||
|
||||
p.runJavaScript('1 + 1', callback)
|
||||
p.printToPdf(print_callback)
|
||||
QTimer.singleShot(5000, lambda: QApplication.instance().quit())
|
||||
QApplication.instance().exec_()
|
||||
test_flaky = isosx and not is_ci
|
||||
if not test_flaky:
|
||||
self.assertEqual(callback.result, 2, 'Simple JS computation failed')
|
||||
self.assertIn(b'Skia/PDF', bytes(print_callback.result), 'Print to PDF failed')
|
||||
del p
|
||||
del na
|
||||
destroy_app()
|
||||
del QWebEnginePage
|
||||
p.runJavaScript('1 + 1', callback)
|
||||
p.printToPdf(print_callback)
|
||||
QTimer.singleShot(5000, lambda: QApplication.instance().quit())
|
||||
QApplication.instance().exec_()
|
||||
test_flaky = isosx and not is_ci
|
||||
if not test_flaky:
|
||||
self.assertEqual(callback.result, 2, 'Simple JS computation failed')
|
||||
self.assertIn(b'Skia/PDF', bytes(print_callback.result), 'Print to PDF failed')
|
||||
del p
|
||||
del na
|
||||
destroy_app()
|
||||
del QWebEnginePage
|
||||
finally:
|
||||
if display_env_var is not None:
|
||||
os.environ['DISPLAY'] = display_env_var
|
||||
|
||||
def test_imaging(self):
|
||||
from PIL import Image
|
||||
|
Loading…
x
Reference in New Issue
Block a user