Commit 5defa995 authored by Michał Kępień's avatar Michał Kępień
Browse files

squash! Fix build-time Python configuration

Further tweaks:

  - Remove dnspython dependency which was erroneously introduced in
    commit 31b0dc1f: no installed Python
    module depends on dnspython, it is only used in system tests, for
    which there are separate scripts which check whether dnspython is
    available and act accordingly.

  - Print a "checking for Python support... disabled" message when
    --without-python is used.

  - Add "2>/dev/null" to the checks for Python dependencies to prevent
    console output from being mangled when the user supplies a bogus
    absolute path to --with-python.

  - Update the top comment so that it matches post-!980 reality.

  - Add a comment to explain "unset ac_cv_path_PYTHON".

  - s/python/Python/; when referring to the language itself rather than a
    specific executable.

  - Reorder test{argparse,minvers,ply} variables (purely cosmetic).
parent 0235ad39
Pipeline #7323 failed with stages
in 15 minutes and 48 seconds
......@@ -1628,7 +1628,7 @@ Optional Packages:
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-sysroot[=DIR] Search for dependent libraries within DIR (or the
compiler's sysroot if not specified).
--with-python=PATH specify path to python interpreter
--with-python=PATH specify path to Python interpreter
--with-python-install-dir=PATH
installation directory for Python modules
--with-geoip=PATH Build with GeoIP support (yes|no|path)
......@@ -12167,9 +12167,19 @@ done
 
 
#
# Python is also optional; it is used by the tools in bin/python.
# If python is unavailable, we simply don't build those.
# Python is also optional but required by default so that dnssec-keymgr gets
# installed unless explicitly prevented by the user using --without-python.
#
testminvers='import sys
if (sys.version_info < (2,7)) or (sys.version_info < (3,2) and sys.version_info >= (3,0)):
exit(1)'
testargparse='try: import argparse
except: exit(1)'
testply='try: import ply
except: exit(1)'
 
# Check whether --with-python was given.
if test "${with_python+set}" = set; then :
......@@ -12187,20 +12197,12 @@ else
fi
 
 
testargparse='try: import argparse
except: exit(1)'
testply='try: from ply import *
except: exit(1)'
testdnspython='try: import dns.message
except: exit(1)'
testminvers='import sys
if (sys.version_info < (2,7)) or (sys.version_info < (3,2) and sys.version_info >= (3,0)):
exit(1)'
if test "$with_python" != "no"; then :
if test "$with_python" = "no"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python support" >&5
$as_echo_n "checking for Python support... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
$as_echo "disabled" >&6; }
else
for p in $with_python
do
case $p in #(
......@@ -12250,6 +12252,11 @@ $as_echo "no" >&6; }
fi
 
 
# Do not cache the result of the check from the previous line. If the
# first found Python interpreter has missing module dependencies and
# the result of the above check is cached, subsequent module checks
# would erroneously keep on using the cached path to the first found
# Python interpreter instead of different ones.
unset ac_cv_path_PYTHON
 
if test -z "$PYTHON"; then :
......@@ -12258,20 +12265,7 @@ fi
 
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $PYTHON is python2 version >= 2.7 or python3 version >= 3.2" >&5
$as_echo_n "checking if $PYTHON is python2 version >= 2.7 or python3 version >= 3.2... " >&6; }
if "$PYTHON" -c "$testminvers"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
unset PYTHON
continue
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python module 'argparse'" >&5
$as_echo_n "checking python module 'argparse'... " >&6; }
if "$PYTHON" -c "$testargparse"; then :
if "$PYTHON" -c "$testminvers" 2>/dev/null; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
......@@ -12281,9 +12275,9 @@ $as_echo "no" >&6; }
continue
fi
 
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python module 'ply'" >&5
$as_echo_n "checking python module 'ply'... " >&6; }
if "$PYTHON" -c "$testply"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Python module 'argparse'" >&5
$as_echo_n "checking Python module 'argparse'... " >&6; }
if "$PYTHON" -c "$testargparse" 2>/dev/null; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
......@@ -12293,9 +12287,9 @@ $as_echo "no" >&6; }
continue
fi
 
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python module 'dnspython'" >&5
$as_echo_n "checking python module 'dnspython'... " >&6; }
if "$PYTHON" -c "$testdnspython"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Python module 'ply'" >&5
$as_echo_n "checking Python module 'ply'... " >&6; }
if "$PYTHON" -c "$testply" 2>/dev/null; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
......@@ -12305,18 +12299,18 @@ $as_echo "no" >&6; }
continue
fi
 
# Jump out of the loop on first good match
# Stop looking any further once we find a Python interpreter
# satisfying all requirements.
break
done
 
if test "X$PYTHON" = "X"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python support" >&5
$as_echo_n "checking for python support... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python support" >&5
$as_echo_n "checking for Python support... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "Python required for dnssec-keymgr" "$LINENO" 5
fi
fi
 
PYTHON_TOOLS=''
......
......@@ -178,80 +178,76 @@ AC_PATH_PROGS(PERL, perl5 perl)
AC_SUBST(PERL)
#
# Python is also optional; it is used by the tools in bin/python.
# If python is unavailable, we simply don't build those.
# Python is also optional but required by default so that dnssec-keymgr gets
# installed unless explicitly prevented by the user using --without-python.
#
testminvers='import sys
if (sys.version_info < (2,7)) or (sys.version_info < (3,2) and sys.version_info >= (3,0)):
exit(1)'
testargparse='try: import argparse
except: exit(1)'
testply='try: import ply
except: exit(1)'
AC_ARG_WITH([python],
AS_HELP_STRING([--with-python=PATH],
[specify path to python interpreter]),
[specify path to Python interpreter]),
[], [with_python="python python3 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python2 python2.7"])
AC_ARG_WITH([python-install-dir],
AS_HELP_STRING([--with-python-install-dir=PATH],
[installation directory for Python modules]),
[], with_python_install_dir="")
testargparse='try: import argparse
except: exit(1)'
testply='try: from ply import *
except: exit(1)'
testdnspython='try: import dns.message
except: exit(1)'
testminvers='import sys
if (sys.version_info < (2,7)) or (sys.version_info < (3,2) and sys.version_info >= (3,0)):
exit(1)'
AS_IF([test "$with_python" != "no"],
AS_IF([test "$with_python" = "no"],
[AC_MSG_CHECKING([for Python support])
AC_MSG_RESULT([disabled])],
[for p in $with_python
do
AS_CASE([$p],
[/*],[PYTHON="$p"])
AC_PATH_PROG([PYTHON], [$p])
# Do not cache the result of the check from the previous line. If the
# first found Python interpreter has missing module dependencies and
# the result of the above check is cached, subsequent module checks
# would erroneously keep on using the cached path to the first found
# Python interpreter instead of different ones.
unset ac_cv_path_PYTHON
AS_IF([test -z "$PYTHON"], [continue])
AC_MSG_CHECKING([if $PYTHON is python2 version >= 2.7 or python3 version >= 3.2])
AS_IF(["$PYTHON" -c "$testminvers"],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
unset PYTHON
continue])
AC_MSG_CHECKING([python module 'argparse'])
AS_IF(["$PYTHON" -c "$testargparse"],
AS_IF(["$PYTHON" -c "$testminvers" 2>/dev/null],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
unset PYTHON
continue])
AC_MSG_CHECKING([python module 'ply'])
AS_IF(["$PYTHON" -c "$testply"],
AC_MSG_CHECKING([Python module 'argparse'])
AS_IF(["$PYTHON" -c "$testargparse" 2>/dev/null],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
unset PYTHON
continue])
AC_MSG_CHECKING([python module 'dnspython'])
AS_IF(["$PYTHON" -c "$testdnspython"],
AC_MSG_CHECKING([Python module 'ply'])
AS_IF(["$PYTHON" -c "$testply" 2>/dev/null],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
unset PYTHON
continue])
# Jump out of the loop on first good match
# Stop looking any further once we find a Python interpreter
# satisfying all requirements.
break
done
AS_IF([test "X$PYTHON" = "X"],
[AC_MSG_CHECKING([for python support])
[AC_MSG_CHECKING([for Python support])
AC_MSG_RESULT([no])
AC_MSG_ERROR([Python required for dnssec-keymgr])])
])
AC_MSG_ERROR([Python required for dnssec-keymgr])])])
PYTHON_TOOLS=''
CHECKDS=''
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment