aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/minstall.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-01-29 15:18:12 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2021-01-30 21:28:21 +0000
commit6c6b5d77d696c160a8f65719058dba2faf783b3e (patch)
tree74e172d60ee634e1a7dd344b75c883841749aad2 /mesonbuild/minstall.py
parentc491d48b9d081125f242227ff9e543abbbb838d8 (diff)
downloadmeson-6c6b5d77d696c160a8f65719058dba2faf783b3e.zip
meson-6c6b5d77d696c160a8f65719058dba2faf783b3e.tar.gz
meson-6c6b5d77d696c160a8f65719058dba2faf783b3e.tar.bz2
add_install_script: add skip_if_destdir kwarg
It is common, at least in GNOME projects, to have scripts that must be run only in the final destination, to update system icon cache, etc. Skipping them from Meson ensures we can properly log that they have not been run instead of relying on such scripts to to it (they don't always).
Diffstat (limited to 'mesonbuild/minstall.py')
-rw-r--r--mesonbuild/minstall.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py
index db08dfe..18dca8b 100644
--- a/mesonbuild/minstall.py
+++ b/mesonbuild/minstall.py
@@ -429,7 +429,7 @@ class Installer:
self.install_man(d, dm, destdir, fullprefix)
self.install_data(d, dm, destdir, fullprefix)
restore_selinux_contexts()
- self.run_install_script(d, fullprefix)
+ self.run_install_script(d, destdir, fullprefix)
if not self.did_install_something:
self.log('Nothing to install.')
if not self.options.quiet and self.preserved_file_count > 0:
@@ -483,7 +483,7 @@ class Installer:
self.did_install_something = True
set_mode(outfilename, install_mode, d.install_umask)
- def run_install_script(self, d: InstallData, fullprefix: str) -> None:
+ def run_install_script(self, d: InstallData, destdir: str, fullprefix: str) -> None:
env = {'MESON_SOURCE_ROOT': d.source_dir,
'MESON_BUILD_ROOT': d.build_dir,
'MESON_INSTALL_PREFIX': d.prefix,
@@ -494,8 +494,11 @@ class Installer:
env['MESON_INSTALL_QUIET'] = '1'
for i in d.install_scripts:
- self.did_install_something = True # Custom script must report itself if it does nothing.
name = ' '.join(i.cmd_args)
+ if i.skip_if_destdir and destdir:
+ self.log('Skipping custom install script because DESTDIR is set {!r}'.format(name))
+ continue
+ self.did_install_something = True # Custom script must report itself if it does nothing.
self.log('Running custom install script {!r}'.format(name))
try:
rc = run_exe(i, env)