From 31133e8ac07c08b607ee7799c0074c1dce37a952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Wed, 11 Jul 2018 14:18:50 +0200 Subject: [PATCH] build: parametrize Python invocations in the shebangs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consequently, there's no reason to have the affected files marked as executable (processing the files by the means of AC_CONFIG_FILES will get rid of any such permission bits, anyway), but at the very least, test/runtests.py needs to be set executable afterwards so as no to cause failures with the current "make check" arrangement that invokes TESTS subtargets directly (i.e. no extension-based LOG_COMPILER set). Signed-off-by: Jan Pokorný --- configure.ac | 12 +++++++++++- script/{unit-test.py => unit-test.py.in} | 2 +- test/{runtests.py => runtests.py.in} | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) rename script/{unit-test.py => unit-test.py.in} (99%) mode change 100755 => 100644 rename test/{runtests.py => runtests.py.in} (98%) mode change 100755 => 100644 diff --git a/configure.ac b/configure.ac index 3bf41b3..a6ad86e 100644 --- a/configure.ac +++ b/configure.ac @@ -97,6 +97,14 @@ CPPFLAGS="$CPPFLAGS $XML2HEAD" PKG_CHECK_MODULES(GLIB, [glib-2.0]) +# Python casing, prefer 3.3+ to 2.{6...} +AM_PATH_PYTHON([3.3], , [PYTHON=:]) +if test "x$PYTHON" = x:; then + AM_PATH_PYTHON([2.6]) +fi +PYTHON_SHEBANG="$PYTHON ${PYTHON_OPTS--Es}" +AC_ARG_VAR([PYTHON_SHEBANG], [Python invocation used in shebangs]) + # Checks for header files. AC_FUNC_ALLOCA AC_HEADER_DIRENT @@ -157,7 +165,9 @@ AC_CONFIG_FILES([Makefile docs/Makefile conf/Makefile]) AC_CONFIG_FILES([conf/booth-arbitrator.service conf/booth@.service]) - +AC_CONFIG_FILES([script/unit-test.py test/runtests.py], + dnl Following required at least for "make check" + [chmod +x test/runtests.py]) AC_CONFIG_FILES([script/service-runnable], [chmod +x script/service-runnable]) # =============================================== diff --git a/script/unit-test.py b/script/unit-test.py.in old mode 100755 new mode 100644 similarity index 99% rename from script/unit-test.py rename to script/unit-test.py.in index 399528e..4f3cf62 --- a/script/unit-test.py +++ b/script/unit-test.py.in @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!@PYTHON_SHEBANG@ # vim: fileencoding=utf-8 # see http://stackoverflow.com/questions/728891/correct-way-to-define-python-source-code-encoding # NOTE: setting the encoding is needed as non-ASCII characters are contained diff --git a/test/runtests.py b/test/runtests.py.in old mode 100755 new mode 100644 similarity index 98% rename from test/runtests.py rename to test/runtests.py.in index 833b1a7..ec59159 --- a/test/runtests.py +++ b/test/runtests.py.in @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!@PYTHON_SHEBANG@ import os import re -- 2.18.0.rc2