[meld/flatpak-ci: 30/31] meld.conf: Template out our runtime config file at build time



commit f6f8301cb50cd3a79a161c96b2d89dd676abfe78
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Nov 30 06:17:07 2019 +1000

    meld.conf: Template out our runtime config file at build time

 meld/conf.py.in  |  7 +++++++
 meld/meson.build | 17 ++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/meld/conf.py.in b/meld/conf.py.in
index 5d0d9d8c..fae36ccc 100644
--- a/meld/conf.py.in
+++ b/meld/conf.py.in
@@ -18,8 +18,15 @@ DATADIR = Path(sys.prefix) / "share" / "meld"
 LOCALEDIR = Path(sys.prefix) / "share" / "locale"
 # END
 
+CONFIGURED = '@configured@'
 PROFILE = ''
 
+if CONFIGURED == 'True':
+    APPLICATION_ID = '@application_id@'
+    DATADIR = '@pkgdatadir@'
+    LOCALEDIR = '@localedir@'
+    PROFILE = '@profile@'
+
 # Flag enabling some workarounds if data dir isn't installed in standard prefix
 DATADIR_IS_UNINSTALLED = False
 PYTHON_REQUIREMENT_TUPLE = (3, 6)
diff --git a/meld/meson.build b/meld/meson.build
index ae3c2ee6..09c9ceae 100644
--- a/meld/meson.build
+++ b/meld/meson.build
@@ -9,7 +9,6 @@ folders = {
         'actiongutter.py',
         'build_helpers.py',
         'chunkmap.py',
-        'conf.py',
         'const.py',
         'diffgrid.py',
         'dirdiff.py',
@@ -84,4 +83,20 @@ foreach folder_name, sources : folders
   python3.install_sources(sources, pure: true, subdir: pkgdir)
 endforeach
 
+# Install the executable file
+app_config = configuration_data()
+app_config.set_quoted('profile', profile)
+app_config.set('application_id', application_id)
+app_config.set('resource_base_id', resource_base_id)
+app_config.set('localedir', localedir)
+app_config.set('pkgdatadir', pkgdatadir)
+app_config.set('configured', 'True')
+
+configure_file(
+    input: 'conf.py.in',
+    output: 'conf.py',
+    configuration: app_config,
+    install_dir: python3.get_install_dir(pure: true, subdir: meson.project_name()),
+)
+
 subdir('resources')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]