1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Have configure check for PyPA build. Fixes #3115

This commit is contained in:
dmiller
2025-05-21 20:47:38 +00:00
parent afdff26fbf
commit 76d932e3ab
4 changed files with 47 additions and 24 deletions

View File

@@ -350,14 +350,6 @@ $(ZENMAPDIR)/zenmapCore/Version.py $(ZENMAPDIR)/share/zenmap/config/zenmap_versi
tests/%: tests/%.cc $(OBJS) tests/%: tests/%.cc $(OBJS)
$(CXX) -o $@ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) $< $(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 build-zenmap: $(ZENMAPDIR)/pyproject.toml $(ZENMAPDIR)/zenmapCore/Version.py
$(PYTHON) -m build $(ZENMAPDIR)/ $(PYTHON) -m build $(ZENMAPDIR)/

View File

@@ -125,3 +125,14 @@ AC_DEFUN([LARGE_FILES_IF_NOT_BROKEN],
AC_LANG_POP(C++) 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])
])

35
configure vendored
View File

@@ -6520,16 +6520,35 @@ printf "%s\n" "$am_cv_python_pyexecdir" >&6; }
PY_BUILD_OK=false
if $HAVE_PYTHON ; then 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 if $PYTHON -c 'import setuptools' 2>/dev/null ; then
have_setuptools=yes py_have_setuptools=yes
else 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 fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_setuptools" >&5
printf "%s\n" "$have_setuptools" >&6; }
fi fi
NDIFFDIR=ndiff NDIFFDIR=ndiff
@@ -6544,7 +6563,7 @@ else $as_nop
with_ndiff=check with_ndiff=check
fi fi
if $HAVE_PYTHON && test "$have_setuptools" = "yes" ; then : ; if $PY_BUILD_OK ; then : ;
else else
if test "$with_ndiff" = "check" ; then 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 { 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 fi
if $HAVE_PYTHON ; then : ; if $PY_BUILD_OK ; then : ;
else else
if test "$with_zenmap" = "check"; then if test "$with_zenmap" = "check"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Not building Zenmap because Python was not found" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Not building Zenmap because Python was not found" >&5

View File

@@ -233,21 +233,22 @@ CHECK_IPV6_IPPROTO_RAW
m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python3 python]) m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python3 python])
AM_PATH_PYTHON([3], [HAVE_PYTHON=true], [HAVE_PYTHON=false]) AM_PATH_PYTHON([3], [HAVE_PYTHON=true], [HAVE_PYTHON=false])
PY_BUILD_OK=false
if $HAVE_PYTHON ; then if $HAVE_PYTHON ; then
AC_MSG_CHECKING([for python setuptools]) CHECK_PYTHON_MODULE(setuptools)
if $PYTHON -c 'import setuptools' 2>/dev/null ; then if test "$py_have_setuptools" = "yes"; then
have_setuptools=yes CHECK_PYTHON_MODULE(build)
else if test "$py_have_build" = "yes"; then
have_setuptools=no PY_BUILD_OK=true
fi
fi fi
AC_MSG_RESULT([$have_setuptools])
fi fi
NDIFFDIR=ndiff NDIFFDIR=ndiff
# Do they want Ndiff? # Do they want Ndiff?
AC_ARG_WITH(ndiff, AC_HELP_STRING([--without-ndiff], [Skip installation of the Ndiff utility]), [], [with_ndiff=check]) 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 else
if test "$with_ndiff" = "check" ; then if test "$with_ndiff" = "check" ; then
AC_MSG_WARN([Not building Ndiff because Python with setuptools was not found]) AC_MSG_WARN([Not building Ndiff because Python with setuptools was not found])
@@ -286,7 +287,7 @@ ZENMAPDIR=zenmap
# Do they want Zenmap? # Do they want Zenmap?
AC_ARG_WITH(zenmap, AC_HELP_STRING([--without-zenmap], [Skip installation of the Zenmap graphical frontend]), [], [with_zenmap=check]) 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 else
if test "$with_zenmap" = "check"; then if test "$with_zenmap" = "check"; then
AC_MSG_WARN([Not building Zenmap because Python was not found]) AC_MSG_WARN([Not building Zenmap because Python was not found])