chiark / gitweb /
Makefile: Try flailing for inkscape extension python fail
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 16 Apr 2021 15:15:43 +0000 (16:15 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 16 Apr 2021 16:01:37 +0000 (17:01 +0100)
Reported-by: Matthew Vernon <matthewv@chiark.greenend.org.uk>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Makefile
run-inkscape-extension [new file with mode: 0755]

index 57352460a179925e36150797d4e34ccf53f4feb3..4c35aa009c9cd3ea7d0a308c448b44c72c3be3c5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -58,7 +58,7 @@ INKSCAPE ?= inkscape
 # inkscape 1.0.2: --system-data-directory, no --extension-directory
 INKSCAPE_EXTENSIONS := $(shell set -e; { sdd=$$( $(INKSCAPE) --system-data-directory ) && echo "$$sdd/extensions"; } || $(INKSCAPE) --extension-directory )
 endif
-RECOLOUR_SVG ?= $(INKSCAPE_EXTENSIONS)/color_replace.py
+RECOLOUR_SVG ?= ./run-inkscape-extension $(INKSCAPE_EXTENSIONS)/color_replace.py
 
 DEPLOY_ARCH=x86_64-unknown-linux-musl
 DEPLOY_RELEASE=debug
diff --git a/run-inkscape-extension b/run-inkscape-extension
new file mode 100755 (executable)
index 0000000..4e1c94a
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# inkscape 0.92.4 on Debian buster:
+# These scripts are perfectly good scripts; they are executable,
+# and they work with the #! that is provided.  They do not work with
+# python2.
+#
+# inkscape 1.0.2 on Debian bullseye:
+# These files are not executable.  They say #!/usr/bin/env python
+# but the system probably doesn't have any such thing, because
+# that would (on a sane system) refer to python2 and there is
+# only python3.
+#
+# I don't think it is going to be possible to sanely find out what
+# python version is actually expected.  But I think a *reasonable*
+# demand on the environment is that either:
+#   - These if these scripts are executable, they can be executed
+#   - Otherwise, they are not using ancient and obsolete python
+
+$(
+  if test -x "$1"; then :; else
+    type -p python3 || type -p python
+  fi
+) "$@"