[tracker-miners/sam/sandbox-rewrite-2] Add run-uninstalled script



commit ff8323030c579414d436395708376fcb10bff04c
Author: Sam Thursfield <sam afuera me uk>
Date:   Tue Sep 10 20:48:30 2019 +0200

    Add run-uninstalled script
    
    This is part of
    https://gitlab.gnome.org/GNOME/tracker/merge_requests/133.

 meson.build        |  9 +++++++++
 run-uninstalled.in | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
---
diff --git a/meson.build b/meson.build
index a7d38e3e9..95eb8ffa8 100644
--- a/meson.build
+++ b/meson.build
@@ -38,6 +38,7 @@ if get_option('tracker_core') == 'system'
   tracker_uninstalled_domain_rule = join_paths 
(tracker_sparql.get_pkgconfig_variable('domain_ontologies_dir'), 'default.rule')
   tracker_uninstalled_nepomuk_ontologies_dir = 
join_paths(tracker_sparql.get_pkgconfig_variable('ontologies_dir'), 'nepomuk')
   tracker_uninstalled_stop_words_dir = join_paths(tracker_sparql.get_pkgconfig_variable('datadir'), 
'tracker', 'stop-words')
+  tracker_uninstalled_testutils_dir = join_paths(tracker_sparql.get_pkgconfig_variable('libdir', 
'tracker-2.0', 'trackertestutils'))
 else
   tracker_subproject = subproject('tracker',
     default_options: [
@@ -55,6 +56,7 @@ else
   tracker_uninstalled_domain_rule = tracker_subproject.get_variable('tracker_uninstalled_domain_rule')
   tracker_uninstalled_nepomuk_ontologies_dir = 
tracker_subproject.get_variable('tracker_uninstalled_nepomuk_ontologies_dir')
   tracker_uninstalled_stop_words_dir = tracker_subproject.get_variable('tracker_uninstalled_stop_words_dir')
+  tracker_uninstalled_testutils_dir = tracker_subproject.get_variable('tracker_uninstalled_testutils_dir')
 
   tracker_common_enums_header = tracker_subproject.get_variable('tracker_common_enums_header')
   tracker_gsettings_schemas = tracker_subproject.get_variable('tracker_gsettings_schemas')
@@ -423,6 +425,13 @@ subdir('po')
 
 meson.add_install_script('meson_integration_commands.sh', glib_compile_schemas.path(), gsettings_schema_dir)
 
+run_uninstalled_conf = configuration_data()
+run_uninstalled_conf.set('tracker_uninstalled_testutils_dir', tracker_uninstalled_testutils_dir)
+configure_file(
+  input: 'run-uninstalled.in',
+  output: 'run-uninstalled',
+  configuration: run_uninstalled_conf)
+
 summary = [
   '\nBuild Configuration:',
   '    Prefix:                                 ' + get_option('prefix'),
diff --git a/run-uninstalled.in b/run-uninstalled.in
new file mode 100755
index 000000000..b36c46ead
--- /dev/null
+++ b/run-uninstalled.in
@@ -0,0 +1,40 @@
+#!/usr/bin/python3
+#
+# Copyright (C) 2019 Sam Thursfield <sam afuera me uk>
+#
+# This is a tool for running development versions of Tracker the build tree.
+#
+# See README.md in tracker.git for usage information.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+import os
+import pathlib
+import sys
+
+TRACKER_UNINSTALLED_TESTUTILS_DIR = "@tracker_uninstalled_testutils_dir@"
+
+testutils_path = pathlib.Path(TRACKER_UNINSTALLED_TESTUTILS_DIR)
+
+build_directory = pathlib.Path(__file__).parent
+dbus_config = build_directory.joinpath('tests/test-bus.conf')
+
+env = os.environ
+pythonpath = env.get('PYTHONPATH', '').split(':')
+env['PYTHONPATH'] = ':'.join([str(testutils_path)] + pythonpath)
+
+args = [sys.executable, '-m', 'trackertestutils', '--dbus-config', dbus_config] + sys.argv[1:]
+os.execve(sys.executable, args, env)


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