aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-10-27 14:33:54 -0400
committerXavier Claessens <xclaesse@gmail.com>2021-10-27 20:49:28 -0400
commit3902bd4ef15ed1c50b008ba2e0e0dad79ff185f4 (patch)
tree759947ce516bbace38ced0b933492d28b4e81b0d
parent18e4b3f4f9f343510923fd21a24dd459e199f2d5 (diff)
downloadmeson-3902bd4ef15ed1c50b008ba2e0e0dad79ff185f4.zip
meson-3902bd4ef15ed1c50b008ba2e0e0dad79ff185f4.tar.gz
meson-3902bd4ef15ed1c50b008ba2e0e0dad79ff185f4.tar.bz2
Fix add_install_script() ignoring install_tag
Fixes: #9454
-rw-r--r--mesonbuild/interpreter/mesonmain.py1
-rw-r--r--test cases/unit/98 install all targets/meson.build3
-rw-r--r--unittests/allplatformstests.py22
3 files changed, 16 insertions, 10 deletions
diff --git a/mesonbuild/interpreter/mesonmain.py b/mesonbuild/interpreter/mesonmain.py
index 5c4d3ed..5d35410 100644
--- a/mesonbuild/interpreter/mesonmain.py
+++ b/mesonbuild/interpreter/mesonmain.py
@@ -154,6 +154,7 @@ class MesonMain(MesonInterpreterObject):
script_args = self._process_script_args('add_install_script', args[1], allow_built=True)
script = self._find_source_script(args[0], script_args)
script.skip_if_destdir = kwargs['skip_if_destdir']
+ script.tag = kwargs['install_tag']
self.build.install_scripts.append(script)
@typed_pos_args(
diff --git a/test cases/unit/98 install all targets/meson.build b/test cases/unit/98 install all targets/meson.build
index 2189f1a..94bd1fe 100644
--- a/test cases/unit/98 install all targets/meson.build
+++ b/test cases/unit/98 install all targets/meson.build
@@ -77,3 +77,6 @@ custom_target('ct3',
install_tag: ['custom', 'devel', false],
install: true,
)
+
+meson.add_install_script('script.py', install_tag: 'custom')
+meson.add_install_script('script.py')
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index 3443076..aec832a 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -3896,17 +3896,19 @@ class AllPlatformTests(BasePlatformTests):
Path(installpath, 'usr/share/out2.txt'),
}
- def do_install(tags=None):
- extra_args = ['--tags', tags] if tags else []
- self._run(self.meson_command + ['install', '--dry-run', '--destdir', self.installdir] + extra_args, workdir=self.builddir)
+ def do_install(tags, expected_files, expected_scripts):
+ cmd = self.meson_command + ['install', '--dry-run', '--destdir', self.installdir]
+ cmd += ['--tags', tags] if tags else []
+ stdout = self._run(cmd, workdir=self.builddir)
installed = self.read_install_logs()
- return sorted(installed)
-
- self.assertEqual(sorted(expected_devel), do_install('devel'))
- self.assertEqual(sorted(expected_runtime), do_install('runtime'))
- self.assertEqual(sorted(expected_custom), do_install('custom'))
- self.assertEqual(sorted(expected_runtime_custom), do_install('runtime,custom'))
- self.assertEqual(sorted(expected_all), do_install())
+ self.assertEqual(sorted(expected_files), sorted(installed))
+ self.assertEqual(expected_scripts, stdout.count('Running custom install script'))
+
+ do_install('devel', expected_devel, 0)
+ do_install('runtime', expected_runtime, 0)
+ do_install('custom', expected_custom, 1)
+ do_install('runtime,custom', expected_runtime_custom, 1)
+ do_install(None, expected_all, 2)
def test_introspect_install_plan(self):
testdir = os.path.join(self.unit_test_dir, '98 install all targets')