[gdk-pixbuf/ebassi/for-master: 5/5] build: Port post-install script to Python
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf/ebassi/for-master: 5/5] build: Port post-install script to Python
- Date: Wed, 7 Apr 2021 18:11:36 +0000 (UTC)
commit 866670e30907eb534895da26626709ed5f2e419d
Author: Emmanuele Bassi <ebassi gnome org>
Date: Wed Apr 7 19:09:25 2021 +0100
build: Port post-install script to Python
Avoid the whole shell/batch file shenanigans.
build-aux/post-install.bat | 24 ------------------------
build-aux/post-install.py | 26 ++++++++++++++++++++++++++
build-aux/post-install.sh | 18 ------------------
meson.build | 19 +++++--------------
4 files changed, 31 insertions(+), 56 deletions(-)
---
diff --git a/build-aux/post-install.py b/build-aux/post-install.py
new file mode 100644
index 000000000..d532ddf73
--- /dev/null
+++ b/build-aux/post-install.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+import subprocess
+
+if 'DESTDIR' not in os.environ:
+ bindir = sys.argv[1]
+ libdir = sys.argv[2]
+ binary_version = sys.argv[3]
+
+ query_loaders = os.path.join(bindir, "gdk-pixbuf-query-loaders")
+ loaders_dir = os.path.join(libdir, "gdk-pixbuf-2.0", binary_version)
+ loaders_cache = os.path.join(loaders_dir, "loaders.cache")
+
+ os.makedirs(loaders_dir, exist_ok=True)
+
+ cmd = [query_loaders]
+ with subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True) as p:
+ data = p.stdout.read()
+
+ with open(loaders_cache, "wb") as f:
+ f.write(data)
+else:
+ print("*** Warning: loaders.cache not built because DESTDIR is set")
+ print("*** You will need to manually call gdk-pixbuf-query-loaders")
diff --git a/meson.build b/meson.build
index 286f17c2d..b84d804c7 100644
--- a/meson.build
+++ b/meson.build
@@ -419,20 +419,11 @@ build_docs = get_option('gtk_doc') or get_option('docs')
subdir('docs')
if not meson.is_cross_build()
- # On Visual Studio, we don't normally have a shell interpreter, so use a .bat
- if cc.get_id() == 'msvc'
- meson.add_install_script('build-aux/post-install.bat',
- gdk_pixbuf_bindir,
- gdk_pixbuf_libdir,
- gdk_pixbuf_binary_version,
- )
- else
- meson.add_install_script('build-aux/post-install.sh',
- gdk_pixbuf_bindir,
- gdk_pixbuf_libdir,
- gdk_pixbuf_binary_version,
- )
- endif
+ meson.add_install_script('build-aux/post-install.py',
+ gdk_pixbuf_bindir,
+ gdk_pixbuf_libdir,
+ gdk_pixbuf_binary_version,
+ )
endif
if not meson.is_subproject()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]