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,7 +204,8 @@ 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)
try:
ensure_app() ensure_app()
self.assertGreaterEqual(len(QFontDatabase().families()), 5, 'The QPA headless plugin is not able to locate enough system fonts via fontconfig') 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 from calibre.ebooks.covers import create_cover
@ -238,6 +239,9 @@ class BuildTest(unittest.TestCase):
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