diff --git a/Makefile.in b/Makefile.in index 29a6d0ef3..212e239af 100644 --- a/Makefile.in +++ b/Makefile.in @@ -350,14 +350,6 @@ $(ZENMAPDIR)/zenmapCore/Version.py $(ZENMAPDIR)/share/zenmap/config/zenmap_versi tests/%: tests/%.cc $(OBJS) $(CXX) -o $@ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $< -# By default distutils rewrites installed scripts to hardcode the -# location of the Python interpreter they were built with (something -# like #!/usr/bin/python2.4). This is the wrong thing to do when -# installing on a machine other than the one used to do the build. Use -# this as the location of the interpreter whenever we're not doing a -# local installation. -DEFAULT_PYTHON_PATH = /usr/bin/env python3 - build-zenmap: $(ZENMAPDIR)/pyproject.toml $(ZENMAPDIR)/zenmapCore/Version.py $(PYTHON) -m build $(ZENMAPDIR)/ diff --git a/acinclude.m4 b/acinclude.m4 index 21c9346b6..ed04f130c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -125,3 +125,14 @@ AC_DEFUN([LARGE_FILES_IF_NOT_BROKEN], AC_LANG_POP(C++) ] ) + +AC_DEFUN([CHECK_PYTHON_MODULE], +[ + AC_MSG_CHECKING([for python module $1]) + if $PYTHON -c 'import $1' 2>/dev/null ; then + py_have_$1=yes + else + py_have_$1=no + fi + AC_MSG_RESULT([$py_have_$1]) +]) diff --git a/configure b/configure index 83814555f..11a3b98c0 100755 --- a/configure +++ b/configure @@ -6520,16 +6520,35 @@ printf "%s\n" "$am_cv_python_pyexecdir" >&6; } +PY_BUILD_OK=false if $HAVE_PYTHON ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python setuptools" >&5 -printf %s "checking for python setuptools... " >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python module setuptools" >&5 +printf %s "checking for python module setuptools... " >&6; } if $PYTHON -c 'import setuptools' 2>/dev/null ; then - have_setuptools=yes + py_have_setuptools=yes else - have_setuptools=no + py_have_setuptools=no + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_have_setuptools" >&5 +printf "%s\n" "$py_have_setuptools" >&6; } + + if test "$py_have_setuptools" = "yes"; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for python module build" >&5 +printf %s "checking for python module build... " >&6; } + if $PYTHON -c 'import build' 2>/dev/null ; then + py_have_build=yes + else + py_have_build=no + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_have_build" >&5 +printf "%s\n" "$py_have_build" >&6; } + + if test "$py_have_build" = "yes"; then + PY_BUILD_OK=true + fi fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_setuptools" >&5 -printf "%s\n" "$have_setuptools" >&6; } fi NDIFFDIR=ndiff @@ -6544,7 +6563,7 @@ else $as_nop with_ndiff=check fi -if $HAVE_PYTHON && test "$have_setuptools" = "yes" ; then : ; +if $PY_BUILD_OK ; then : ; else if test "$with_ndiff" = "check" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Not building Ndiff because Python with setuptools was not found" >&5 @@ -6595,7 +6614,7 @@ else $as_nop fi -if $HAVE_PYTHON ; then : ; +if $PY_BUILD_OK ; then : ; else if test "$with_zenmap" = "check"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Not building Zenmap because Python was not found" >&5 diff --git a/configure.ac b/configure.ac index 6abc148e5..54d7734a7 100644 --- a/configure.ac +++ b/configure.ac @@ -233,21 +233,22 @@ CHECK_IPV6_IPPROTO_RAW m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python3 python]) AM_PATH_PYTHON([3], [HAVE_PYTHON=true], [HAVE_PYTHON=false]) +PY_BUILD_OK=false if $HAVE_PYTHON ; then - AC_MSG_CHECKING([for python setuptools]) - if $PYTHON -c 'import setuptools' 2>/dev/null ; then - have_setuptools=yes - else - have_setuptools=no + CHECK_PYTHON_MODULE(setuptools) + if test "$py_have_setuptools" = "yes"; then + CHECK_PYTHON_MODULE(build) + if test "$py_have_build" = "yes"; then + PY_BUILD_OK=true + fi fi - AC_MSG_RESULT([$have_setuptools]) fi NDIFFDIR=ndiff # Do they want Ndiff? AC_ARG_WITH(ndiff, AC_HELP_STRING([--without-ndiff], [Skip installation of the Ndiff utility]), [], [with_ndiff=check]) -if $HAVE_PYTHON && test "$have_setuptools" = "yes" ; then : ; +if $PY_BUILD_OK ; then : ; else if test "$with_ndiff" = "check" ; then AC_MSG_WARN([Not building Ndiff because Python with setuptools was not found]) @@ -286,7 +287,7 @@ ZENMAPDIR=zenmap # Do they want Zenmap? AC_ARG_WITH(zenmap, AC_HELP_STRING([--without-zenmap], [Skip installation of the Zenmap graphical frontend]), [], [with_zenmap=check]) -if $HAVE_PYTHON ; then : ; +if $PY_BUILD_OK ; then : ; else if test "$with_zenmap" = "check"; then AC_MSG_WARN([Not building Zenmap because Python was not found])