Mercurial > sat_docs
diff flatpak/sat_wrapper.py @ 138:274af514a5cf
flatpak: reworked packages + made a building script:
a new `build_manifest.py` script can now be used to generate flatpak manifests for every frontend of SàT.
The manifest can be used both for development versions and stable ones.
Templates files (in the form `_tmp_<app-id>.json`) are used to set building instructions.
A common runtime specific to SàT has been abandoned following a discussion on the official mailing list.
A small wrapper is now used to launch backend automatically if it's not found.
Desktop and app metadata have been added for Cagou.
Jp and Primitivus don't have appdata and desktop files yet.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 22 Jun 2019 15:59:07 +0200 |
parents | |
children | 2602c690806b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flatpak/sat_wrapper.py Sat Jun 22 15:59:07 2019 +0200 @@ -0,0 +1,26 @@ +#!/usr/bin/env python2 +# -*- coding: utf-8 -*- +"""This script launch SàT backend if it's not before running command""" + +import os +import sys +import dbus +import subprocess + +command = "##COMMAND##" +const_INT_PREFIX = "org.salutatoi.SAT" +const_OBJ_PATH = '/org/salutatoi/SAT/bridge' + + +try: + sessions_bus = dbus.SessionBus() + db_object = sessions_bus.get_object(const_INT_PREFIX, + const_OBJ_PATH) +except dbus.exceptions.DBusException as e: + if e._dbus_error_name != 'org.freedesktop.DBus.Error.ServiceUnknown': + raise e + # backend not found, we need to launch it + print("Launching SàT backend") + subprocess.check_call("sat") + +os.execlp(command, command, *sys.argv[1:])