Skip to content

Commit

Permalink
sbus: dectect python binary for sbus_generate.sh
Browse files Browse the repository at this point in the history
We already detect python2 and python3 binaries during configure. With
this patch PYTHON_EXEC is set to the python3 binary if python3 bindings
are generated and to the python2 binary otherwise. With the help of an
environment variable sbus_generate.sh is made aware of it.

Related to https://pagure.io/SSSD/sssd/issue/3807

Reviewed-by: Pavel Březina <pbrezina@redhat.com>
  • Loading branch information
sumit-bose authored and jhrozek committed Sep 19, 2018
1 parent 1e23988 commit b03179e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile.am
Expand Up @@ -1020,14 +1020,14 @@ libsss_cert_la_LDFLAGS = \
$(NULL)

generate-sbus-code:
$(srcdir)/sbus_generate.sh $(abs_srcdir)
$(builddir)/sbus_generate.sh $(abs_srcdir)

.PHONY: generate-sbus-code

BUILT_SOURCES += generate-sbus-code

EXTRA_DIST += \
sbus_generate.sh \
sbus_generate.sh.in \
src/sbus/codegen/dbus.xml \
src/sbus/codegen/sbus_CodeGen.py \
src/sbus/codegen/sbus_DataType.py \
Expand Down
8 changes: 8 additions & 0 deletions configure.ac
Expand Up @@ -373,6 +373,13 @@ them please use argument --without-python3-bindings when running configure.])])
SSS_CLEAN_PYTHON_VARIABLES
fi

if test x$HAVE_PYTHON3_BINDINGS = x1; then
PYTHON_EXEC=$PYTHON3
else
PYTHON_EXEC=$PYTHON2
fi
AC_SUBST(PYTHON_EXEC)

AM_CONDITIONAL([BUILD_PYTHON_BINDINGS],
[test x"$with_python2_bindings" = xyes \
-o x"$with_python3_bindings" = xyes])
Expand Down Expand Up @@ -524,4 +531,5 @@ AC_CONFIG_FILES([Makefile contrib/sssd.spec src/examples/rwtab src/doxy.config
src/config/setup.py
src/systemtap/sssd.stp
src/config/SSSDConfig/__init__.py])
AC_CONFIG_FILES([sbus_generate.sh], [chmod +x sbus_generate.sh])
AC_OUTPUT
2 changes: 1 addition & 1 deletion sbus_generate.sh → sbus_generate.sh.in
Expand Up @@ -13,7 +13,7 @@ generate() {

echo "Generating sbus code for: $XML"

python $CODEGEN --sbus sbus --util util \
@PYTHON_EXEC@ $CODEGEN --sbus sbus --util util \
--headers "$HEADERS" \
--dest "$SRCDIR/src/$DEST" \
--fileprefix "sbus_${PREFIX}_" \
Expand Down

0 comments on commit b03179e

Please sign in to comment.