Skip to content

Commit

Permalink
configure checks for python3 packages, but does not install them
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmcgrew committed Sep 30, 2019
1 parent 5cce599 commit 712ff15
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 80 deletions.
85 changes: 10 additions & 75 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@ ac_subst_vars='LTLIBOBJS
VALGRIND
WGET
JQ
PIP3
PYTHON3
LIBOBJS
ac_ct_CXX
Expand Down Expand Up @@ -4475,69 +4474,18 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: omitting embedded python3 analysis engine - either python3 was not found, or --disable-python option was invoked" >&5
$as_echo "$as_me: omitting embedded python3 analysis engine - either python3 was not found, or --disable-python option was invoked" >&6;}
fi
# Check whether --enable-python was given.
if test "${enable_python+set}" = set; then :
enableval=$enable_python;
else
# Extract the first word of "pip3", so it can be a program name with args.
set dummy pip3; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_PIP3+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$PIP3"; then
ac_cv_prog_PIP3="$PIP3" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_PIP3="yes"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
PIP3=$ac_cv_prog_PIP3
if test -n "$PIP3"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PIP3" >&5
$as_echo "$PIP3" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test "x$PIP3" = xyes; then :
for ac_header in pcap.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default"
if test "x$ac_cv_header_pcap_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PCAP_H 1
_ACEOF
if test "x$PYTHON3" = xyes; then :
if python3 ./package_test.py; then :
else
as_fn_error $? "pcap.h not found; lipcap-dev seems not to be installed" "$LINENO" 5
fi
done
as_fn_error $? "python package(s) not found; install with 'pip3 install cython ujson pyasn', or ./configure --disable-python" "$LINENO" 5
fi
if test "x$PIP3" = xyes; then :
ac_config_commands="$ac_config_commands pip3"
fi
#AC_ARG_ENABLE(python, AS_HELP_STRING([--disable-python], [omit embedded python analysis engine]), [], [AC_CHECK_PROG(PIP3,pip3,yes)])
#AS_IF([test "x$PIP3" = xyes],
# [AC_CHECK_HEADERS([pcap.h], [], [AC_MSG_ERROR([pcap.h not found; lipcap-dev seems not to be installed])])])
#AS_IF([test "x$PIP3" = xyes],
# [AC_CONFIG_COMMANDS([pip3], [pip3 install cython ujson pyasn])])
# Extract the first word of "jq", so it can be a program name with args.
set dummy jq; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
Expand Down Expand Up @@ -5234,7 +5182,6 @@ esac
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_commands="$ac_config_commands"
_ACEOF
Expand All @@ -5259,9 +5206,6 @@ Usage: $0 [OPTION]... [TAG]...
Configuration files:
$config_files
Configuration commands:
$config_commands
Report bugs to the package provider."
_ACEOF
Expand Down Expand Up @@ -5378,7 +5322,6 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"pip3") CONFIG_COMMANDS="$CONFIG_COMMANDS pip3" ;;
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
Expand All @@ -5393,7 +5336,6 @@ done
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
Expand Down Expand Up @@ -5582,7 +5524,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS"
eval set X " :F $CONFIG_FILES "
shift
for ac_tag
do
Expand Down Expand Up @@ -5792,16 +5734,9 @@ which seems to be undefined. Please make sure it is defined" >&2;}
;;
:C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
$as_echo "$as_me: executing $ac_file commands" >&6;}
;;
esac
case $ac_file$ac_mode in
"pip3":C) pip3 install cython dpkt ujson numpy pyasn hpack pypcap ;;
esac
done # for ac_tag
Expand Down
15 changes: 10 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ AC_ARG_ENABLE(python, AS_HELP_STRING([--disable-python], [omit embedded python a
AS_IF([test "x$PYTHON3" = xyes],
[AC_DEFINE([HAVE_PYTHON3], [1], [python3 is available.])],
[AC_MSG_NOTICE([omitting embedded python3 analysis engine - either python3 was not found, or --disable-python option was invoked])])
AC_ARG_ENABLE(python, AS_HELP_STRING([--disable-python], [omit embedded python analysis engine]), [], [AC_CHECK_PROG(PIP3,pip3,yes)])
AS_IF([test "x$PIP3" = xyes],
[AC_CHECK_HEADERS([pcap.h], [], [AC_MSG_ERROR([pcap.h not found; lipcap-dev seems not to be installed])])])
AS_IF([test "x$PIP3" = xyes],
[AC_CONFIG_COMMANDS([pip3], [pip3 install cython dpkt ujson numpy pyasn hpack pypcap])])
AS_IF([test "x$PYTHON3" = xyes],
[AS_IF([python3 ./package_test.py],
[],
[AC_MSG_ERROR([python package(s) not found; install with 'pip3 install cython ujson pyasn', or ./configure --disable-python])])],
[])
#AC_ARG_ENABLE(python, AS_HELP_STRING([--disable-python], [omit embedded python analysis engine]), [], [AC_CHECK_PROG(PIP3,pip3,yes)])
#AS_IF([test "x$PIP3" = xyes],
# [AC_CHECK_HEADERS([pcap.h], [], [AC_MSG_ERROR([pcap.h not found; lipcap-dev seems not to be installed])])])
#AS_IF([test "x$PIP3" = xyes],
# [AC_CONFIG_COMMANDS([pip3], [pip3 install cython ujson pyasn])])
AC_CHECK_PROG(JQ,jq,yes)
AC_CHECK_PROG(WGET,wget,yes)
AC_CHECK_PROG(VALGRIND,valgrind,yes)
Expand Down
10 changes: 10 additions & 0 deletions package_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# run as: python3 package_test.py
#
# return value will be 0 (success) only if all needed packages are available

import cython
import ujson
import pyasn

print ("found python packages cython, ujson, pyasn")

0 comments on commit 712ff15

Please sign in to comment.