dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0020-sbus-dectect-python-binary-for-sbus_generate.sh.patch

71e593
From 8b43e5149d9726de3a573ba8b4e44fd68b328f92 Mon Sep 17 00:00:00 2001
71e593
From: Sumit Bose <sbose@redhat.com>
71e593
Date: Mon, 10 Sep 2018 15:40:14 +0200
71e593
Subject: [PATCH] sbus: dectect python binary for sbus_generate.sh
71e593
MIME-Version: 1.0
71e593
Content-Type: text/plain; charset=UTF-8
71e593
Content-Transfer-Encoding: 8bit
71e593
71e593
We already detect python2 and python3 binaries during configure. With
71e593
this patch PYTHON_EXEC is set to the python3 binary if python3 bindings
71e593
are generated and to the python2 binary otherwise. With the help of an
71e593
environment variable sbus_generate.sh is made aware of it.
71e593
71e593
Related to https://pagure.io/SSSD/sssd/issue/3807
71e593
71e593
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
71e593
(cherry picked from commit b03179ead11db7dbfd6a00d3eeef3dac0990f826)
71e593
---
71e593
 Makefile.am                             | 4 ++--
71e593
 configure.ac                            | 8 ++++++++
71e593
 sbus_generate.sh => sbus_generate.sh.in | 2 +-
71e593
 3 files changed, 11 insertions(+), 3 deletions(-)
71e593
 rename sbus_generate.sh => sbus_generate.sh.in (93%)
71e593
71e593
diff --git a/Makefile.am b/Makefile.am
71e593
index 85952818c9a8efd957ce99f4595b251265cc5417..1602ec6236799015fa7fd9f1707cb2bcdb20e07b 100644
71e593
--- a/Makefile.am
71e593
+++ b/Makefile.am
71e593
@@ -1019,14 +1019,14 @@ libsss_cert_la_LDFLAGS = \
71e593
     $(NULL)
71e593
 
71e593
 generate-sbus-code:
71e593
-	$(srcdir)/sbus_generate.sh $(abs_srcdir)
71e593
+	$(builddir)/sbus_generate.sh $(abs_srcdir)
71e593
 
71e593
 .PHONY: generate-sbus-code
71e593
 
71e593
 BUILT_SOURCES += generate-sbus-code
71e593
 
71e593
 EXTRA_DIST += \
71e593
-    sbus_generate.sh \
71e593
+    sbus_generate.sh.in \
71e593
     src/sbus/codegen/dbus.xml \
71e593
     src/sbus/codegen/sbus_CodeGen.py \
71e593
     src/sbus/codegen/sbus_DataType.py \
71e593
diff --git a/configure.ac b/configure.ac
71e593
index 891610e14490a4e78e1e95e63c18d9c6a9a8afb4..5816b04c6651ee9cd4ddfae9a1cb0ab44f3ea4e0 100644
71e593
--- a/configure.ac
71e593
+++ b/configure.ac
71e593
@@ -373,6 +373,13 @@ them please use argument --without-python3-bindings when running configure.])])
71e593
     SSS_CLEAN_PYTHON_VARIABLES
71e593
 fi
71e593
 
71e593
+if test x$HAVE_PYTHON3_BINDINGS = x1; then
71e593
+    PYTHON_EXEC=$PYTHON3
71e593
+else
71e593
+    PYTHON_EXEC=$PYTHON2
71e593
+fi
71e593
+AC_SUBST(PYTHON_EXEC)
71e593
+
71e593
 AM_CONDITIONAL([BUILD_PYTHON_BINDINGS],
71e593
                [test x"$with_python2_bindings" = xyes \
71e593
                      -o x"$with_python3_bindings" = xyes])
71e593
@@ -525,4 +532,5 @@ AC_CONFIG_FILES([Makefile contrib/sssd.spec src/examples/rwtab src/doxy.config
71e593
                  src/config/setup.py
71e593
                  src/systemtap/sssd.stp
71e593
                  src/config/SSSDConfig/__init__.py])
71e593
+AC_CONFIG_FILES([sbus_generate.sh], [chmod +x sbus_generate.sh])
71e593
 AC_OUTPUT
71e593
diff --git a/sbus_generate.sh b/sbus_generate.sh.in
71e593
similarity index 93%
71e593
rename from sbus_generate.sh
71e593
rename to sbus_generate.sh.in
71e593
index 338fd9d3387d6d4694e08de3d537d6a54e78a560..b2c695e700901bcff77ebbe2d1887cd572ec5e52 100755
71e593
--- a/sbus_generate.sh
71e593
+++ b/sbus_generate.sh.in
71e593
@@ -13,7 +13,7 @@ generate() {
71e593
 
71e593
     echo "Generating sbus code for: $XML"
71e593
 
71e593
-    python $CODEGEN --sbus sbus --util util \
71e593
+    @PYTHON_EXEC@ $CODEGEN --sbus sbus --util util \
71e593
         --headers "$HEADERS" \
71e593
         --dest "$SRCDIR/src/$DEST" \
71e593
         --fileprefix "sbus_${PREFIX}_" \
71e593
-- 
71e593
2.14.4
71e593