summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2021-04-07 19:09:25 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2021-04-07 19:11:30 +0100
commit866670e30907eb534895da26626709ed5f2e419d (patch)
treeff40382fa391f7c0f3c2c5d41bffcb633d578305 /build-aux
parent6e8a9c608649db887705d3666cbd39e924319cb4 (diff)
downloadgdk-pixbuf-866670e30907eb534895da26626709ed5f2e419d.tar.gz
build: Port post-install script to Python
Avoid the whole shell/batch file shenanigans.
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/post-install.bat24
-rw-r--r--build-aux/post-install.py26
-rw-r--r--build-aux/post-install.sh18
3 files changed, 26 insertions, 42 deletions
diff --git a/build-aux/post-install.bat b/build-aux/post-install.bat
deleted file mode 100644
index 6994d49e1..000000000
--- a/build-aux/post-install.bat
+++ /dev/null
@@ -1,24 +0,0 @@
-@echo off
-
-set bindir=%1
-set libdir=%2
-set binary_version=%3
-
-set libdir_windows=%libdir:/=\%
-
-if not "%DESTDIR%" == "" goto warn_msg
-if not exist %libdir_windows%\gdk-pixbuf-2.0\%binary_version%\ mkdir %libdir_windows%\gdk-pixbuf-2.0\%binary_version%
-%bindir%\gdk-pixbuf-query-loaders > %libdir_windows%\gdk-pixbuf-2.0\%binary_version%\loaders.cache
-
-goto end
-
-:warn_msg
-echo ***
-echo *** Warning: loaders.cache not built
-echo ***
-echo *** You should generate this file manually on the host system
-echo *** using:
-echo *** gdk-pixbuf-query-loaders ^> %libdir_windows%\gdk-pixbuf-2.0\%binary_version%\loaders.cache
-echo ***
-
-:end
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/build-aux/post-install.sh b/build-aux/post-install.sh
deleted file mode 100644
index 661bceeef..000000000
--- a/build-aux/post-install.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-bindir="$1"
-libdir="$2"
-binary_version="$3"
-
-if [ -z "$DESTDIR" ]; then
- mkdir -p "$libdir/gdk-pixbuf-2.0/$binary_version"
- $bindir/gdk-pixbuf-query-loaders > "$libdir/gdk-pixbuf-2.0/$binary_version/loaders.cache"
-else
- echo "***"
- echo "*** Warning: loaders.cache not built"
- echo "***"
- echo "*** You should generate this file manually on the host system"
- echo "*** using:"
- echo "*** gdk-pixbuf-query-loaders > $libdir/gdk-pixbuf-2.0/$binary_version/loaders.cache"
- echo "***"
-fi