Blame SOURCES/use-specified-python-interpreter.patch

89a1c0
commit e3e904af7dd308fe7530773bd9ea136afc90049b
89a1c0
Author: John Dennis <jdennis@redhat.com>
89a1c0
Date:   Thu Jun 21 10:49:30 2018 -0400
89a1c0
89a1c0
    Use python interpreter specified configure script
89a1c0
    
89a1c0
    The configure script allows you to specify the python interpreter to
89a1c0
    use via the --with-python option. There were several places where the
89a1c0
    python interpreter was implicity invoked without using the specified
89a1c0
    version. This can create a number of problems in an environment with
89a1c0
    multiple python versions as is the case during the transition from
89a1c0
    Python 2 to Python 3. Python 2 is not compatible with Python
89a1c0
    3. Lasso's Python code is supposed to be compatible with both
89a1c0
    versions. But during the build and when running the unit tests it is
89a1c0
    essential the same interpreter be used consistently otherwise you can
89a1c0
    have problems.
89a1c0
    
89a1c0
    This patch assures whenever python is invoked it does so via the
89a1c0
    $(PYTHON) configuration variable.
89a1c0
    
89a1c0
    What about shebang lines (e.g #/usr/bin/python) at the top of scripts?
89a1c0
    Python PEP 394 (https://www.python.org/dev/peps/pep-0394/) covers
89a1c0
    this. Basically it says if a script is compatible only with Py2 the
89a1c0
    shebang should be #/usr/bin/python2, if only compatible with Py3 the
89a1c0
    shebang should be #/usr/bin/python3. However, if the script is
89a1c0
    compatible with both versions it can continue to use the
89a1c0
    compatible with both Py2 and Py3.
89a1c0
    
89a1c0
    License: MIT
89a1c0
    Signed-off-by: John Dennis <jdennis@redhat.com>
89a1c0
89a1c0
diff --git a/bindings/java/Makefile.am b/bindings/java/Makefile.am
89a1c0
index 05e5f9ee..8de0178d 100644
89a1c0
--- a/bindings/java/Makefile.am
89a1c0
+++ b/bindings/java/Makefile.am
89a1c0
@@ -26,7 +26,7 @@ if WSF_ENABLED
89a1c0
 EXTRA_ARGS = --enable-id-wsf
89a1c0
 endif
89a1c0
 
89a1c0
-java_lasso_source_files := $(shell python $(top_srcdir)/bindings/bindings.py -l java-list --src-dir=$(top_srcdir)/lasso/ $(EXTRA_ARGS) )
89a1c0
+java_lasso_source_files := $(shell $(PYTHON) $(top_srcdir)/bindings/bindings.py -l java-list --src-dir=$(top_srcdir)/lasso/ $(EXTRA_ARGS) )
89a1c0
 
89a1c0
 lasso_jardir=$(prefix)/share/java
89a1c0
 lasso_jar_DATA=lasso.jar
89a1c0
diff --git a/bindings/python/tests/Makefile.am b/bindings/python/tests/Makefile.am
89a1c0
index 205e7613..1305f26f 100644
89a1c0
--- a/bindings/python/tests/Makefile.am
89a1c0
+++ b/bindings/python/tests/Makefile.am
89a1c0
@@ -11,5 +11,8 @@ if WSF_ENABLED
89a1c0
 TESTS += idwsf1_tests.py idwsf2_tests.py
89a1c0
 endif
89a1c0
 
89a1c0
+TEST_EXTENSIONS = .py
89a1c0
+PY_LOG_COMPILER = $(PYTHON)
89a1c0
+
89a1c0
 EXTRA_DIST = profiles_tests.py binding_tests.py idwsf1_tests.py idwsf2_tests.py \
89a1c0
 	tests.py XmlTestRunner.py
89a1c0
diff --git a/lasso/Makefile.am b/lasso/Makefile.am
89a1c0
index 751f9419..49ae88a7 100644
89a1c0
--- a/lasso/Makefile.am
89a1c0
+++ b/lasso/Makefile.am
89a1c0
@@ -91,7 +91,7 @@ liblasso_la_LDFLAGS = -no-undefined -version-info @LASSO_VERSION_INFO@  \
89a1c0
 endif
89a1c0
 
89a1c0
 $(srcdir)/errors.c: $(srcdir)/errors.h $(srcdir)/build_strerror.py
89a1c0
-	python $(srcdir)/build_strerror.py $(srcdir) >.errors.c.new
89a1c0
+	$(PYTHON) $(srcdir)/build_strerror.py $(srcdir) >.errors.c.new
89a1c0
 	if ! cmp -s $(srcdir)/errors.c .errors.c.new; then \
89a1c0
 	mv -f .errors.c.new $@; else \
89a1c0
 	rm .errors.c.new; fi
89a1c0
diff --git a/tools/check-lasso-sections.py b/tools/check-lasso-sections.py
89a1c0
index cb4c39c4..3a6c9880 100755
89a1c0
--- a/tools/check-lasso-sections.py
89a1c0
+++ b/tools/check-lasso-sections.py
89a1c0
@@ -1,4 +1,4 @@
89a1c0
-#!/usr/bin/python
89a1c0
+#!/usr/bin/env python
89a1c0
 
89a1c0
 import sys
89a1c0
 import os.path