Commit a1fd726b authored by Christopher Davis's avatar Christopher Davis 🌱

Allow dual install of Authenticator

Flatpak CI allows us to generate a CI bundle that we can install
alongside the stable versions of Authenticator. With this commit
the stable Authenticator is no longer overwritten when installing
a development flatpak.
parent 581dd1d1
......@@ -15,11 +15,11 @@ flatpak:
FLATPAK_MODULE: "Authenticator"
script:
- flatpak-builder --stop-at=${FLATPAK_MODULE} app ${MANIFEST_PATH}
- flatpak build app meson --prefix=/app ${MESON_ARGS} _build
- flatpak build app meson -Dprofile=development --prefix=/app ${MESON_ARGS} _build
- flatpak build app ninja -C _build install
- flatpak-builder --finish-only --repo=repo app ${MANIFEST_PATH}
- flatpak build-export repo app
- flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} com.github.bilelmoussaoui.Authenticator
- flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} com.github.bilelmoussaoui.AuthenticatorDevel
artifacts:
paths:
- ${BUNDLE}
......
......@@ -35,9 +35,9 @@ class Application(Gtk.Application):
def __init__(self):
Gtk.Application.__init__(self,
application_id="com.github.bilelmoussaoui.Authenticator",
application_id="@APP_ID@",
flags=Gio.ApplicationFlags.FLAGS_NONE)
GLib.set_application_name(_("Authenticator"))
GLib.set_application_name(_("Authenticator@NAME_SUFFIX@"))
GLib.set_prgname("Authenticator")
self.connect("notify::is-locked", self.__is_locked_changed)
self.alive = True
......
......@@ -41,7 +41,7 @@ def load_pixbuf(icon_name, size):
except GLib.Error:
pass
if not pixbuf:
pixbuf = theme.load_icon("com.github.bilelmoussaoui.Authenticator",
pixbuf = theme.load_icon("@APP_ID@",
size, 0)
if pixbuf and (pixbuf.props.width != size or pixbuf.props.height != size):
......
......@@ -39,7 +39,7 @@ class AboutDialog(Gtk.AboutDialog):
"""
self.set_authors(["Bilal Elmoussaoui"])
self.set_artists(["Alexandros Felekidis"])
self.set_logo_icon_name("com.github.bilelmoussaoui.Authenticator")
self.set_logo_icon_name("@APP_ID@")
self.set_license_type(Gtk.License.GPL_3_0)
self.set_program_name(_("Authenticator"))
self.set_translator_credits(_("translator-credits"))
......
......@@ -43,7 +43,7 @@ class Window(Gtk.ApplicationWindow, GObject.GObject):
def __init__(self):
Gtk.ApplicationWindow.__init__(self, type=Gtk.WindowType.TOPLEVEL)
self.set_icon_name("com.github.bilelmoussaoui.Authenticator")
self.set_icon_name("@APP_ID@")
self.get_style_context().add_class("authenticator-window")
self.resize(550, 600)
self.connect("locked", self.__on_locked)
......
......@@ -129,9 +129,9 @@ class AuthenticatorSearchProvider(Server, Gio.Application):
</interface>
</node>
'''
__AUTHENTICATOR_BUS = 'com.github.bilelmoussaoui.Authenticator.SearchProvider'
__AUTHENTICATOR_BUS = '@APP_ID@.SearchProvider'
__SEARCH_BUS = 'org.gnome.Shell.SearchProvider2'
__PATH_BUS = '/com/github/bilelmoussaoui/Authenticator/SearchProvider'
__PATH_BUS = '/com/github/bilelmoussaoui/Authenticator@PROFILE@/SearchProvider'
def __init__(self):
Gio.Application.__init__(
......
......@@ -73,7 +73,7 @@ if __name__ == "__main__":
from Authenticator import Application
app = Application.get_default()
Application.IS_DEVEL = "@IS_DEVEL@" == 'True'
Application.IS_DEVEL = "@PROFILE@" == 'Devel'
Application.USE_QRSCANNER = "@ENABLE_QRSCANNER@" == 'True'
exit_status = app.run(None)
sys.exit(exit_status)
......
{
"app-id": "com.github.bilelmoussaoui.Authenticator",
"app-id": "com.github.bilelmoussaoui.AuthenticatorDevel",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
......@@ -144,12 +144,12 @@
{
"name": "Authenticator",
"buildsystem": "meson",
"config-opts":[
"-Dis_devel=true"
"config-opts": [
"-Dprofile=development"
],
"sources": [{
"type": "git",
"url": "git@gitlab.gnome.org:World/Authenticator.git",
"url": "https://gitlab.gnome.org/World/Authenticator.git",
"branch": "master"
}]
}
......
[Shell Search Provider]
DesktopId=com.github.bilelmoussaoui.Authenticator.desktop
BusName=com.github.bilelmoussaoui.Authenticator.SearchProvider
ObjectPath=/com/github/bilelmoussaoui/Authenticator/SearchProvider
Version=2
[Shell Search Provider]
DesktopId=@appid@.desktop
BusName=@appid@.SearchProvider
ObjectPath=/com/github/bilelmoussaoui/Authenticator@profile@/SearchProvider
Version=2
[D-BUS Service]
Name=com.github.bilelmoussaoui.Authenticator.SearchProvider
Name=@appid@.SearchProvider
Exec=@libexecdir@/authenticator-search-provider
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>com.github.bilelmoussaoui.Authenticator.desktop</id>
<id>@appid@.desktop</id>
<metadata_license>CC0</metadata_license>
<project_license>GPL-3.0+</project_license>
<name>Authenticator</name>
......
......@@ -7,6 +7,6 @@ Exec=authenticator
Terminal=false
Categories=GNOME;GTK;Security;Network;
Keywords=Gnome;GTK;Verification;
Icon=com.github.bilelmoussaoui.Authenticator
Icon=@icon@
StartupNotify=true
StartupWMClass=com.github.bilelmoussaoui.Authenticator
......@@ -9,12 +9,12 @@ foreach theme : icon_themes
icon_dir = join_paths(theme, size , 'apps')
icon_name = join_paths(icon_dir, meson.project_name() + extension)
dest = join_paths(get_option('prefix'), 'share/icons', icon_dir)
install_data(icon_name, install_dir: dest)
install_data(icon_name, install_dir: dest, rename: '@0@'.format(application_id) + extension)
endforeach
symbolic_dir = join_paths(theme, 'symbolic/apps/')
symbolic_icon = join_paths(symbolic_dir, meson.project_name() + '-symbolic.svg')
dest_symbolic = join_paths(get_option('prefix'), 'share/icons', symbolic_dir)
install_data(symbolic_icon,
install_dir: dest_symbolic)
install_dir: dest_symbolic, rename: '@0@'.format(application_id) + '-symbolic.svg')
endforeach
......@@ -3,56 +3,75 @@ gnome.compile_resources(
meson.project_name() + '.gresource.xml',
gresource_bundle: true,
source_dir: '.',
install_dir: join_paths(get_option('datadir'), meson.project_name()),
install_dir: join_paths(datadir, meson.project_name()),
install: true
)
install_data(
meson.project_name() + '.gschema.xml',
install_dir : join_paths(get_option('datadir'), 'glib-2.0/schemas')
install_dir : join_paths(datadir, 'glib-2.0/schemas')
)
search_service_provider_conf = configuration_data()
search_service_provider_conf.set('appid', application_id)
search_service_provider_conf.set('profile', profile)
configure_file(
input: meson.project_name() + '.SearchProvider.service.in',
output: meson.project_name() + '.SearchProvider.service',
configuration: conf,
install_dir: join_paths(get_option('datadir'), 'dbus-1/services')
configuration: search_service_provider_conf,
input: files(meson.project_name() + '.SearchProvider.service.in'),
install_dir: join_paths(datadir, 'gnome-shell', 'search-providers'),
output: '@0@.SearchProvider.service'.format(application_id)
)
install_data(
meson.project_name() + '.SearchProvider.ini',
install_dir: join_paths(get_option('datadir'), 'gnome-shell/search-providers')
search_provider_conf = configuration_data()
search_provider_conf.set('appid', application_id)
search_provider_conf.set('profile', profile)
configure_file(
configuration: search_provider_conf,
input: files(meson.project_name() + '.SearchProvider.ini.in'),
install_dir: join_paths(datadir, 'gnome-shell', 'search-providers'),
output: '@0@.SearchProvider.ini'.format(application_id)
)
i18n.merge_file(
output: meson.project_name() + '.desktop',
input: meson.project_name() + '.desktop.in',
desktop_conf = configuration_data()
desktop_conf.set('icon', application_id)
desktop = i18n.merge_file(
'desktop',
input: configure_file(
input: files(meson.project_name() + '.desktop.in.in'),
output: '@0@.desktop.in'.format(application_id),
configuration: desktop_conf
),
output: '@0@.desktop'.format(application_id),
po_dir: join_paths(meson.source_root(), 'po'),
type: 'desktop',
install: true,
install_dir: join_paths(get_option('datadir'), 'applications')
install_dir: join_paths(datadir, 'applications')
)
i18n.merge_file(
output: meson.project_name() + '.appdata.xml',
input: meson.project_name() + '.appdata.xml.in',
appdata_conf = configuration_data()
appdata_conf.set('appid', application_id)
appdata = i18n.merge_file(
'appdata',
input: configure_file(
input: files(meson.project_name() + '.appdata.xml.in.in'),
output: '@0@.appdata.xml.in'.format(application_id),
configuration: appdata_conf
),
output: '@0@.appdata.xml'.format(application_id),
po_dir: join_paths(meson.source_root(), 'po'),
install: true,
install_dir: join_paths(get_option('datadir'), 'appdata')
install_dir: join_paths(datadir, 'appdata')
)
desktop_file_validate = find_program('desktop-file-validate', required:false)
if desktop_file_validate.found()
test (
'Validate desktop file',
desktop_file_validate,
args: join_paths(meson.current_build_dir (),
meson.project_name() + '.desktop')
args: join_paths(meson.current_build_dir(), '@0@.desktop'.format(application_id))
)
endif
......@@ -64,8 +83,7 @@ if appstreamcli.found()
appstreamcli,
args: [
'validate-relax',
join_paths(meson.current_build_dir(),
meson.project_name() + '.appdata.xml')
join_paths(meson.current_build_dir(), '@0@.appdata.xml'.format(application_id))
]
)
endif
......
......@@ -8,6 +8,17 @@ python = import('python3')
gnome = import('gnome')
i18n = import('i18n')
if get_option('profile') == 'development'
profile = 'Devel'
name_suffix = ' (Development)'
else
profile = ''
name_suffix = ''
endif
application_id = 'com.github.bilelmoussaoui.Authenticator@0@'.format(profile)
datadir = get_option('datadir')
message('Looking for dependencies')
dependency('glib-2.0')
dependency('gobject-2.0')
......@@ -38,6 +49,7 @@ subproject('libgd',
# Configuration params
conf = configuration_data()
conf.set('APP_ID', application_id)
conf.set('DATA_DIR', DATA_DIR)
conf.set('LOCALE_DIR', LOCALE_DIR)
conf.set('PYTHON_DIR', join_paths(get_option('prefix'), python.sysconfig_path('purelib')))
......@@ -45,7 +57,8 @@ conf.set('PYTHON_EXEC_DIR', join_paths(get_option('prefix'), python.sysconfig_pa
conf.set('VERSION', meson.project_version())
conf.set('ENABLE_QRSCANNER', get_option('enable_zbar'))
conf.set('LIB_DIR', LIB_DIR)
conf.set('IS_DEVEL', get_option('is_devel'))
conf.set('PROFILE', profile)
conf.set('NAME_SUFFIX', name_suffix)
conf.set('libexecdir', join_paths(get_option('prefix'), get_option('libexecdir')))
conf.set('PYTHON', python_bin.path())
......@@ -77,11 +90,39 @@ configure_file(
'Authenticator/widgets')
)
configure_file(
input: 'Authenticator/widgets/window.py.in',
output: 'window.py',
configuration: conf,
install_dir : join_paths(python.sysconfig_path('purelib'),
'Authenticator/widgets')
)
configure_file(
input: 'Authenticator/utils.py.in',
output: 'utils.py',
configuration: conf,
install_dir : join_paths(python.sysconfig_path('purelib'),
'Authenticator')
)
configure_file(
input: 'Authenticator/application.py.in',
output: 'application.py',
configuration: conf,
install_dir : join_paths(python.sysconfig_path('purelib'),
'Authenticator')
)
install_subdir(
'Authenticator',
install_dir: python.sysconfig_path('purelib'),
exclude_files: 'widgets/about.py.in'
exclude_files: [
'widgets/about.py.in',
'widgets/window.py.in',
'utils.py.in',
'application.py.in'
]
)
meson.add_install_script('meson_post_install.py')
option('enable_zbar', type : 'boolean', value : true, description : 'Enable QR Scanner using zbar')
option('is_devel', type : 'boolean', value : false, description : 'Enabled with Flatpak nightlies bundles')
option(
'profile',
type: 'combo',
choices: [
'default',
'development'
],
value: 'default'
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment