[tracker/trackerutils-arch-independent] meson: Add option to define whether to install and where test utils



commit 181ca9442b498c16a70713f6b069e612870d488d
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Sep 17 14:22:44 2019 +0200

    meson: Add option to define whether to install and where test utils
    
    Since commit 8ae99192 we provide tracker test utils python modules.
    These are installed by default in tracker internal libdir, and as per meson
    default this is an arch-dependent path, while the test utils aren't.
    
    So in some distributions, not to provide such files in multiple packages for
    each architecture, we'd need to install those files somewhere else that is not
    arch-dependent.
    
    Unfortunately meson doesn't provide such path by default (which ideally would be
    /usr/lib/tracker-${abi-version}), and I think isn't correct either to install
    such files into the datadir, so in order to make this path customizable and at
    the same time to make it possible to locate, provide a meson option and build a
    pkg config file for it, providing the python path variable that should be used.

 meson_options.txt                  |  2 ++
 utils/trackertestutils/meson.build | 26 ++++++++++++++++++++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/meson_options.txt b/meson_options.txt
index fa1ce51dc..836060763 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -22,3 +22,5 @@ option('dbus_services', type: 'string', value: '',
        description: 'Directory to install D-Bus .service files (leave blank to use the value from 
dbus-1.pc)')
 option('systemd_user_services', type: 'string', value: 'yes',
        description: 'Directory to install systemd user .service files (or "yes" for default directory, "no" 
to disable installation)')
+option('test_utils', type: 'string', value: 'yes',
+       description: 'Directory to install tracker test utils (or "yes" for default directory, "no" to 
disable installation)')
diff --git a/utils/trackertestutils/meson.build b/utils/trackertestutils/meson.build
index e8ab94c72..4795e94d8 100644
--- a/utils/trackertestutils/meson.build
+++ b/utils/trackertestutils/meson.build
@@ -1,3 +1,5 @@
+pkg = import('pkgconfig')
+
 sources = [
   '__init__.py',
   'dbusdaemon.py',
@@ -7,5 +9,25 @@ sources = [
   'psutil_mini.py',
 ]
 
-install_data(sources,
-  install_dir: join_paths(tracker_internal_libs_dir, 'trackertestutils'))
+install_test_utils = false
+if get_option('test_utils') == 'yes' or get_option('test_utils') == 'auto'
+  arch_independent_libdir = \
+    get_option('prefix') / 'lib' / 'tracker-' + tracker_api_version
+  testutils_dir = join_paths(arch_independent_libdir, 'trackertestutils')
+  install_test_utils = true
+elif get_option('test_utils') != 'no' and get_option('test_utils') != ''
+  testutils_dir = get_option('test_utils')
+  install_test_utils = true
+endif
+
+if install_test_utils
+  install_data(sources, install_dir: testutils_dir)
+
+  pkg.generate(
+    name: 'tracker-testutils-' + tracker_api_version,
+    description: 'tracker test utilities',
+    variables: [
+      'python_path=' + testutils_dir
+    ]
+  )
+endif


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