From 2caf557e1022a79e3812a84cd2aaf4651061ac63 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 27 Jun 2018 13:44:18 +1000 Subject: [PATCH] tools: rely on the libinput and quirks tool to pick the right directories Don't use a custom hack here, just make sure the tool ends up in the builddir so it's picked up by the libinput main tool. This means the PATH isn't set up correctly when called directly (./builddir/libinput-measure-touchpad-pressure) but the workaround is to always use the libinput tool - just as we expect from users. To make it more obvious that we're not supposed to run this directly, rename the source file to .py Signed-off-by: Peter Hutterer --- meson.build | 25 ++++++++-------------- ...e-touch-size => libinput-measure-touch-size.py} | 10 +-------- ...ssure => libinput-measure-touchpad-pressure.py} | 10 +-------- 3 files changed, 11 insertions(+), 34 deletions(-) rename tools/{libinput-measure-touch-size => libinput-measure-touch-size.py} (96%) rename tools/{libinput-measure-touchpad-pressure => libinput-measure-touchpad-pressure.py} (95%) diff --git a/meson.build b/meson.build index 8ec7a62..590fb78 100644 --- a/meson.build +++ b/meson.build @@ -572,16 +572,12 @@ configure_file(input : 'tools/libinput-measure-touchpad-tap.man', install_dir : join_paths(get_option('mandir'), 'man1') ) -config_builddir = configuration_data() -config_builddir.set('BUILDDIR', meson.build_root()) -# libinput-measure-touchpad-pressure gets built but we install_data the -# source instead. The built file is the one that uses the local quirks -# and should be used for debugging. -install_data('tools/libinput-measure-touchpad-pressure', - install_dir : libinput_tool_path) -configure_file(input: 'tools/libinput-measure-touchpad-pressure', +config_noop = configuration_data() +configure_file(input: 'tools/libinput-measure-touchpad-pressure.py', output: 'libinput-measure-touchpad-pressure', - configuration : config_builddir + configuration : config_noop, + install : true, + install_dir : libinput_tool_path ) configure_file(input : 'tools/libinput-measure-touchpad-pressure.man', @@ -590,14 +586,11 @@ configure_file(input : 'tools/libinput-measure-touchpad-pressure.man', install : true, install_dir : join_paths(get_option('mandir'), 'man1') ) -# libinput-measure-touch-size gets built but we install_data the source -# instead. The built file is the one that uses the local quirks and -# should be used for debugging. -install_data('tools/libinput-measure-touch-size', - install_dir : libinput_tool_path) -configure_file(input: 'tools/libinput-measure-touch-size', +configure_file(input: 'tools/libinput-measure-touch-size.py', output: 'libinput-measure-touch-size', - configuration : config_builddir + configuration : config_noop, + install : true, + install_dir : libinput_tool_path ) configure_file(input : 'tools/libinput-measure-touch-size.man', diff --git a/tools/libinput-measure-touch-size b/tools/libinput-measure-touch-size.py similarity index 96% rename from tools/libinput-measure-touch-size rename to tools/libinput-measure-touch-size.py index a262435..9687e0b 100755 --- a/tools/libinput-measure-touch-size +++ b/tools/libinput-measure-touch-size.py @@ -222,15 +222,7 @@ class Device(object): sys.exit(1) def _init_thresholds_from_quirks(self): - # This is replaced for the version in builddir but left as-is for - # the installed version. For the builddir one we need to run the - # builddir quirks list - builddir = '@BUILDDIR@' - if builddir != '@' + 'BUILDDIR' + '@': - command = [os.path.join(builddir, 'libinput-quirks'), 'list'] - else: - command = ['libinput', 'quirks', 'list'] - command.append(self.path) + command = ['libinput', 'quirks', 'list', self.path] cmd = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if cmd.returncode != 0: print("Error querying quirks: {}".format(cmd.stderr.decode('utf-8')), file=sys.stderr) diff --git a/tools/libinput-measure-touchpad-pressure b/tools/libinput-measure-touchpad-pressure.py similarity index 95% rename from tools/libinput-measure-touchpad-pressure rename to tools/libinput-measure-touchpad-pressure.py index b842cbd..5d30a8b 100755 --- a/tools/libinput-measure-touchpad-pressure +++ b/tools/libinput-measure-touchpad-pressure.py @@ -200,15 +200,7 @@ class Device(object): sys.exit(1) def _init_thresholds_from_quirks(self): - # This is replaced for the version in builddir but left as-is for - # the installed version. For the builddir one we need to run the - # builddir quirks list - builddir = '@BUILDDIR@' - if builddir != '@' + 'BUILDDIR' + '@': - command = [os.path.join(builddir, 'libinput-quirks'), 'list'] - else: - command = ['libinput', 'quirks', 'list'] - command.append(self.path) + command = ['libinput', 'quirks', 'list', self.path] cmd = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if cmd.returncode != 0: print("Error querying quirks: {}".format(cmd.stderr.decode('utf-8')), file=sys.stderr) -- 2.7.4