mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
add const.py options to dynamically set version
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
"name" : "warehouse",
|
||||
"builddir" : true,
|
||||
"buildsystem" : "meson",
|
||||
"config-opts": [ "-Dprofile=development" ],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "dir",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
project('warehouse',
|
||||
version: '1.3.1.beta',
|
||||
version: '1.3.1',
|
||||
meson_version: '>= 0.62.0',
|
||||
default_options: [ 'warning_level=2', 'werror=false', ],
|
||||
)
|
||||
@@ -7,8 +7,6 @@ project('warehouse',
|
||||
i18n = import('i18n')
|
||||
gnome = import('gnome')
|
||||
|
||||
|
||||
|
||||
subdir('data')
|
||||
subdir('src')
|
||||
subdir('po')
|
||||
|
||||
9
meson_options.txt
Normal file
9
meson_options.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
option(
|
||||
'profile',
|
||||
type: 'combo',
|
||||
choices: [
|
||||
'default',
|
||||
'development'
|
||||
],
|
||||
value: 'default'
|
||||
)
|
||||
8
src/const.py.in
Normal file
8
src/const.py.in
Normal file
@@ -0,0 +1,8 @@
|
||||
#!@PYTHON@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
class Config:
|
||||
DEVEL = '@DEVEL@' == 'Development'
|
||||
PROFILE = '@DEVEL@'
|
||||
APP_ID = '@APPID@'
|
||||
VERSION = '@VERSION@'
|
||||
@@ -30,12 +30,13 @@ from .window import WarehouseWindow
|
||||
from .remotes_window import RemotesWindow
|
||||
from .orphans_window import OrphansWindow
|
||||
from .search_install_window import SearchInstallWindow
|
||||
from .const import Config
|
||||
|
||||
class WarehouseApplication(Adw.Application):
|
||||
"""The main application singleton class."""
|
||||
|
||||
troubleshooting = "OS: {os}\nWarehouse version: {wv}\nGTK: {gtk}\nlibadwaita: {adw}\nApp ID: {app_id}\nLanguage: {lang}"
|
||||
version = "1.3.1.beta"
|
||||
troubleshooting = "OS: {os}\nWarehouse version: {wv}\nGTK: {gtk}\nlibadwaita: {adw}\nApp ID: {app_id}\nProfile: {profile}\nLanguage: {lang}"
|
||||
version = Config.VERSION
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
@@ -62,7 +63,7 @@ class WarehouseApplication(Adw.Application):
|
||||
os_string = GLib.get_os_info("NAME") + " " + GLib.get_os_info("VERSION")
|
||||
lang = GLib.environ_getenv(GLib.get_environ(), "LANG")
|
||||
|
||||
self.troubleshooting = self.troubleshooting.format( os = os_string, wv = self.version, gtk = gtk_version, adw = adw_version, app_id = self.get_application_id(), lang = lang )
|
||||
self.troubleshooting = self.troubleshooting.format( os = os_string, wv = self.version, gtk = gtk_version, adw = adw_version, profile = Config.PROFILE, app_id = self.get_application_id(), lang = lang )
|
||||
|
||||
def open_search_install(self, widget, _):
|
||||
SearchInstallWindow(self.props.active_window).present()
|
||||
|
||||
@@ -31,7 +31,15 @@ python = import('python')
|
||||
|
||||
conf = configuration_data()
|
||||
conf.set('PYTHON', python.find_installation('python3').full_path())
|
||||
conf.set('APPID', 'io.github.flattool.Warehouse') # TODO: dynamic version and appID
|
||||
if get_option('profile') == 'development'
|
||||
vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip()
|
||||
conf.set('DEVEL', 'Development')
|
||||
conf.set('VERSION', meson.project_version() + '.dev-' + vcs_tag)
|
||||
else
|
||||
conf.set('DEVEL', 'Default')
|
||||
conf.set('VERSION', meson.project_version())
|
||||
endif
|
||||
conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir')))
|
||||
conf.set('pkgdatadir', pkgdatadir)
|
||||
|
||||
@@ -68,4 +76,13 @@ warehouse_sources = [
|
||||
'properties.blp',
|
||||
]
|
||||
|
||||
configure_file(
|
||||
input: 'const.py.in',
|
||||
output: 'const.py',
|
||||
configuration: conf,
|
||||
install: true,
|
||||
install_dir: moduledir,
|
||||
install_mode: 'r-xr--r--',
|
||||
)
|
||||
|
||||
install_data(warehouse_sources, install_dir: moduledir)
|
||||
|
||||
@@ -2,10 +2,6 @@ using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template $WarehouseWindow: Adw.ApplicationWindow {
|
||||
styles [
|
||||
"devel"
|
||||
]
|
||||
|
||||
Adw.ToolbarView main_toolbar_view {
|
||||
[top]
|
||||
HeaderBar header_bar {
|
||||
|
||||
@@ -28,6 +28,7 @@ from .common import myUtils
|
||||
from .remotes_window import RemotesWindow
|
||||
from .downgrade_window import DowngradeWindow
|
||||
from .snapshots_window import SnapshotsWindow
|
||||
from .const import Config
|
||||
|
||||
from .app_row_widget import AppRow
|
||||
|
||||
@@ -825,6 +826,9 @@ class WarehouseWindow(Adw.ApplicationWindow):
|
||||
file_drop.connect("drop", self.drop_callback)
|
||||
self.scrolled_window.add_controller(file_drop)
|
||||
|
||||
if Config.DEVEL:
|
||||
self.add_css_class("devel")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user