Skip to content

Commit

Permalink
Setup devel builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Ketok4321 committed Jan 15, 2024
1 parent 6305f1b commit 47fbee4
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 25 deletions.
14 changes: 10 additions & 4 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
desktop_file_in = configure_file(
input: 'xyz.ketok.Speedtest.desktop.in',
output: '@app_id@.desktop.in',
configuration: conf,
)

desktop_file = i18n.merge_file(
input: 'xyz.ketok.Speedtest.desktop.in',
output: 'xyz.ketok.Speedtest.desktop',
input: desktop_file_in,
output: f'@app_id@.desktop',
type: 'desktop',
po_dir: '../po',
install: true,
Expand All @@ -14,7 +20,7 @@ endif

appstream_file = i18n.merge_file(
input: 'xyz.ketok.Speedtest.metainfo.xml.in',
output: 'xyz.ketok.Speedtest.metainfo.xml',
output: f'@app_id@.metainfo.xml',
po_dir: '../po',
install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo')
Expand All @@ -25,7 +31,7 @@ if appstream_util.found()
test('Validate appstream file', appstream_util, args: ['validate', appstream_file])
endif

install_data('xyz.ketok.Speedtest.gschema.xml',
install_data(f'xyz.ketok.Speedtest.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas')
)

Expand Down
2 changes: 1 addition & 1 deletion data/xyz.ketok.Speedtest.desktop.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Desktop Entry]
Name=Speedtest
Exec=speedtest
Icon=xyz.ketok.Speedtest
Icon=@APP_ID@
Terminal=false
Type=Application
Categories=GTK;
Expand Down
18 changes: 18 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ project('speedtest',

i18n = import('i18n')
gnome = import('gnome')
python = import('python')

pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())

if get_option('development')
app_id = 'xyz.ketok.Speedtest.Devel'
else
app_id = 'xyz.ketok.Speedtest'
endif

conf = configuration_data()
conf.set('PYTHON', python.find_installation('python3').path())
conf.set('VERSION', meson.project_version())
conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('pkgdatadir', pkgdatadir)

conf.set('APP_ID', app_id)
conf.set('DEVEL', get_option('development'))

subdir('data')
subdir('src')
Expand Down
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
option('development', type: 'boolean', value: false, description: 'If this is a development build')
3 changes: 3 additions & 0 deletions src/conf.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VERSION = "@VERSION@"
APP_ID = "@APP_ID@"
DEVEL = "@DEVEL@"
16 changes: 8 additions & 8 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from gi.repository import GLib, Gio, Gtk, Adw

from .conf import *
from .window import SpeedtestWindow, SpeedtestPreferencesWindow
from .gauge import Gauge # This class isn't used there but it the widget needs to be registered
from .fetch_worker import FetchWorker
Expand All @@ -15,12 +16,11 @@
from .backends.librespeed import LibrespeedBackend

class SpeedtestApplication(Adw.Application):
def __init__(self, version):
super().__init__(application_id="xyz.ketok.Speedtest", flags=Gio.ApplicationFlags.DEFAULT_FLAGS)
def __init__(self):
super().__init__(application_id=APP_ID, flags=Gio.ApplicationFlags.DEFAULT_FLAGS)

self.servers = None
self.win = None
self.version = version
self.settings = Gio.Settings("xyz.ketok.Speedtest")
self.fetch_worker = None
self.test_worker = None
Expand Down Expand Up @@ -55,17 +55,17 @@ def load_backend(self):
self.fetch_worker.stop_event.set()
self.fetch_worker.join()

self.backend = LibrespeedBackend(f"KetokSpeedtest/{self.version}")
self.backend = LibrespeedBackend(f"KetokSpeedtest/{VERSION}")

self.fetch_worker = FetchWorker(self)
self.fetch_worker.start()

def on_about_action(self, widget, __):
about = Adw.AboutWindow(transient_for=self.props.active_window,
application_name=_("Speedtest"),
application_icon="xyz.ketok.Speedtest",
application_icon=APP_ID,
developer_name="Ketok",
version=self.version,
version=VERSION,
issue_url="https://github.com/Ketok4321/speedtest/issues",
developers=["Ketok"],
copyright="© 2023 Ketok",
Expand Down Expand Up @@ -103,6 +103,6 @@ def create_action(self, name, callback, shortcuts=None):

return action

def main(version):
app = SpeedtestApplication(version)
def main():
app = SpeedtestApplication()
return app.run(sys.argv)
15 changes: 6 additions & 9 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
moduledir = join_paths(pkgdatadir, 'speedtest')
gnome = import('gnome')

Expand All @@ -23,14 +22,6 @@ gnome.compile_resources('speedtest',
dependencies: blueprints,
)

python = import('python')

conf = configuration_data()
conf.set('PYTHON', python.find_installation('python3').path())
conf.set('VERSION', meson.project_version())
conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('pkgdatadir', pkgdatadir)

configure_file(
input: 'speedtest.in',
output: 'speedtest',
Expand All @@ -51,6 +42,12 @@ speedtest_sources = [
'util.py',
]

speedtest_sources += configure_file(
input: 'conf.py.in',
output: 'conf.py',
configuration: conf
)

backends_sources = [
'backends/librespeed.py',
]
Expand Down
3 changes: 1 addition & 2 deletions src/speedtest.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import signal
import locale
import gettext

VERSION = '@VERSION@'
pkgdatadir = '@pkgdatadir@'
localedir = '@localedir@'

Expand All @@ -43,4 +42,4 @@ if __name__ == '__main__':
resource._register()

from speedtest import main
sys.exit(main.main(VERSION))
sys.exit(main.main())
4 changes: 3 additions & 1 deletion xyz.ketok.Speedtest.yml → xyz.ketok.Speedtest.Devel.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app-id: xyz.ketok.Speedtest
app-id: xyz.ketok.Speedtest.Devel
runtime: org.gnome.Platform
runtime-version: '45'
sdk: org.gnome.Sdk
Expand Down Expand Up @@ -37,6 +37,8 @@ modules:
- name: speedtest
builddir: true
buildsystem: meson
config-opts:
- -Ddevelopment=true
sources:
- type: dir
path: .

0 comments on commit 47fbee4

Please sign in to comment.