Skip to content

Commit

Permalink
configure.ac: restore nut_with_pynut_py* checks from v2.8.2, but test…
Browse files Browse the repository at this point in the history
… for "socket" instead of "telnetlib" module [#2183]

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
  • Loading branch information
jimklimov committed Feb 7, 2025
1 parent a940334 commit 6d671b0
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2921,6 +2921,44 @@ if test x"${nut_with_nut_monitor}" != xno ; then
fi
dnl ### AC_MSG_NOTICE([nut_with_nut_monitor-6: ${nut_with_nut_monitor}])

dnl ${nut_with_pynut}: TODO: arg values to request python 2, 3 or both
AC_MSG_CHECKING([if we can and should install PyNUT module])
nut_with_pynut_py=""
nut_with_pynut_py2=""
nut_with_pynut_py3=""
if test x"${nut_with_pynut}" != xno \
-a -n "${PYTHON}${PYTHON2}${PYTHON3}" \
; then
if test -n "${PYTHON2}" \
&& (command -v ${PYTHON2} || which ${PYTHON2}) >/dev/null 2>/dev/null \
; then
if ${PYTHON2} -c "import socket" \
; then
nut_with_pynut_py2="yes"
fi
fi

if test -n "${PYTHON3}" \
&& (command -v ${PYTHON3} || which ${PYTHON3}) >/dev/null 2>/dev/null \
; then
if ${PYTHON3} -c "import socket" \
; then
nut_with_pynut_py3="yes"
fi
fi

dnl Test same-ness of pythons with sys.version also?
if test -n "${PYTHON}" \
&& (command -v ${PYTHON} || which ${PYTHON}) >/dev/null 2>/dev/null \
&& test "${PYTHON}" != "${PYTHON2}" -a "${PYTHON}" != "${PYTHON3}" \
; then
if ${PYTHON} -c "import socket" \
; then
nut_with_pynut_py="yes"
fi
fi
fi

if test -z "${nut_with_pynut_py}${nut_with_pynut_py2}${nut_with_pynut_py3}" ; then
dnl Not all prereqs are available...
case "${nut_with_pynut}" in
Expand Down

0 comments on commit 6d671b0

Please sign in to comment.