Skip to content
Snippets Groups Projects
Commit f05ebc4e authored by Simon McVittie's avatar Simon McVittie
Browse files

test-ui: Cope with pressure-vessel-wrap not existing


This makes it easier to try out UI changes in the source tree: we can
do everything except actually launching pressure-vessel-wrap.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 720233aa
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@
import logging
import os
import shlex
import subprocess
import sys
......@@ -84,6 +85,7 @@ class Gui:
def __init__(self):
# type: (...) -> None
self.failed = False
self.home = GLib.get_home_dir()
self.container_runtimes = {} # type: typing.Dict[str, str]
......@@ -292,18 +294,21 @@ class Gui:
row += 1
subproc = subprocess.Popen(
[
os.path.join(
os.path.dirname(__file__),
'pressure-vessel-wrap'
),
'--version-only',
],
stdout=subprocess.PIPE,
)
stdout, _ = subproc.communicate()
version = stdout.decode('utf-8', errors='replace')
try:
subproc = subprocess.Popen(
[
os.path.join(
os.path.dirname(__file__),
'pressure-vessel-wrap'
),
'--version-only',
],
stdout=subprocess.PIPE,
)
stdout, _ = subproc.communicate()
version = stdout.decode('utf-8', errors='replace')
except Exception:
version = ''
if version:
label = Gtk.Label.new('')
......@@ -434,8 +439,6 @@ class Gui:
# type: (typing.Any) -> None
argv = [
'env',
'G_MESSAGES_DEBUG=all',
os.path.join(
os.path.dirname(__file__),
'pressure-vessel-wrap'
......@@ -487,13 +490,24 @@ class Gui:
argv.append('--verbose')
argv.extend(sys.argv[1:])
os.execvp(argv[0], argv)
os.environ['G_MESSAGES_DEBUG'] = 'all'
try:
os.execvp(argv[0], argv)
except OSError:
logger.error('Unable to run: %s', ' '.join(map(shlex.quote, argv)))
Gtk.main_quit()
self.failed = True
raise
def run(self):
# type: (...) -> None
self.window.show_all()
Gtk.main()
if self.failed:
sys.exit(1)
if __name__ == '__main__':
if '--check-gui-dependencies' not in sys.argv:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment