From 4b028661aba80c1e5147498ea71d53ce8a3f8a87 Mon Sep 17 00:00:00 2001 From: Jeff Ahrenholz Date: Fri, 27 Sep 2019 11:02:01 -0700 Subject: [PATCH 1/6] fix #290 use pythondir var as base for setting PYTHONLIBDIR --- daemon/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 2f112b85..0182b291 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -15,7 +15,7 @@ DOCS = doc endif if PYTHON3 -PYTHONLIBDIR=$(libdir)/python3/dist-packages +PYTHONLIBDIR=$(shell echo $(pythondir) | sed -e 's/site-packages/dist-packages/') else PYTHONLIBDIR=$(pythondir) endif From cd747515ea7e8e85034ce201ea94823af3f17123 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Fri, 27 Sep 2019 12:11:14 -0700 Subject: [PATCH 2/6] added python path change to ns3 and simplified substitution, which is not version dependent --- daemon/Makefile.am | 6 +----- ns3/Makefile.am | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 0182b291..a6503cc0 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -14,11 +14,7 @@ if WANT_DOCS DOCS = doc endif -if PYTHON3 -PYTHONLIBDIR=$(shell echo $(pythondir) | sed -e 's/site-packages/dist-packages/') -else -PYTHONLIBDIR=$(pythondir) -endif +PYTHONLIBDIR=$(subst site-packages,dist-packages,$(pythondir)) SUBDIRS = proto $(DOCS) diff --git a/ns3/Makefile.am b/ns3/Makefile.am index c1858665..115a7008 100644 --- a/ns3/Makefile.am +++ b/ns3/Makefile.am @@ -9,11 +9,7 @@ if WANT_PYTHON -if PYTHON3 -PYTHONLIBDIR=$(libdir)/python3/dist-packages -else -PYTHONLIBDIR=$(pythondir) -endif +PYTHONLIBDIR=$(subst site-packages,dist-packages,$(pythondir)) SETUPPY = setup.py SETUPPYFLAGS = -v From 03cf401639a96fd27b9fc39583bf6f47bc3a41c2 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Fri, 27 Sep 2019 12:41:34 -0700 Subject: [PATCH 3/6] moved AM_CONDITIONAL out of if statement --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4f774f6d..80b76cec 100644 --- a/configure.ac +++ b/configure.ac @@ -110,7 +110,6 @@ if test "x$enable_daemon" = "xyes"; then AC_CHECK_FUNCS([atexit dup2 gettimeofday memset socket strerror uname]) AM_PATH_PYTHON(2.7) - AM_CONDITIONAL([PYTHON3], [test "x$PYTHON" == "xpython3"]) AS_IF([$PYTHON -m grpc_tools.protoc -h &> /dev/null], [], [AC_MSG_ERROR([please install python grpcio-tools])]) AC_CHECK_PROG(brctl_path, brctl, $as_dir, no, $SEARCHPATH) @@ -157,6 +156,8 @@ if test "x$enable_daemon" = "xyes"; then CFLAGS=$CFLAGS_save CPPFLAGS=$CPPFLAGS_save fi +AM_CONDITIONAL([PYTHON3], [test "x$PYTHON" == "xpython3"]) + if [ test "x$enable_daemon" = "xyes" || test "x$enable_vnodedonly" = "xyes" ] ; then want_linux_netns=yes PKG_CHECK_MODULES(libev, libev, From 3cf557024c21e9aa8b9b703c928843ffb3154d8f Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Fri, 27 Sep 2019 13:08:59 -0700 Subject: [PATCH 4/6] added more formal configure option for enabling python3, avoids issues with not having a very specific name for PYTHON being set --- configure.ac | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 80b76cec..fdd04f16 100644 --- a/configure.ac +++ b/configure.ac @@ -54,6 +54,13 @@ if test "x$enable_python" = "xyes" ; then else want_python=no fi + +AC_ARG_ENABLE([python3], + [AS_HELP_STRING([--enable-python3], + [enable python3 default is python2])], + [enable_python3=yes], [enable_python3=no]) +AM_CONDITIONAL([PYTHON3], [test "x$enable_python3" == "xyes"]) + AC_ARG_ENABLE([daemon], [AS_HELP_STRING([--enable-daemon[=ARG]], [build and install the daemon with Python modules @@ -156,7 +163,6 @@ if test "x$enable_daemon" = "xyes"; then CFLAGS=$CFLAGS_save CPPFLAGS=$CPPFLAGS_save fi -AM_CONDITIONAL([PYTHON3], [test "x$PYTHON" == "xpython3"]) if [ test "x$enable_daemon" = "xyes" || test "x$enable_vnodedonly" = "xyes" ] ; then want_linux_netns=yes From f5aa74ed06bc0cb9be761e7a09dd1382c5a8d2f6 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Fri, 27 Sep 2019 13:15:20 -0700 Subject: [PATCH 5/6] updated install doc to refer to new configure option for building packages --- docs/install.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/install.md b/docs/install.md index 761c589c..291c62ab 100644 --- a/docs/install.md +++ b/docs/install.md @@ -249,7 +249,7 @@ sudo yum -y install automake gcc python-devel libev-devel tk ```shell ./bootstrap.sh -# use python2 or python3 depending on desired version +# $VERSION should be path to python2/3 PYTHON=$VERSION ./configure make sudo make install @@ -268,7 +268,7 @@ sudo apt install python3-sphinx sudo yum install python3-sphinx ./bootstrap.sh -# use python2 or python3 depending on desired version +# $VERSION should be path to python2/3 PYTHON=$VERSION ./configure make doc ``` @@ -282,8 +282,10 @@ Build package commands, DESTDIR is used to make install into and then for packag ```shell ./bootstrap.sh -# use python2 or python3 depending on desired version -PYTHON=$VERSION ./configure +# for python2 +PYTHON=python2 ./configure +# for python3 +PYTHON=python3 ./configure --enable-python3 make mkdir /tmp/core-build make fpm DESTDIR=/tmp/core-build From 07c28e8a93dcc308bd8ec4db627006bfce385fe0 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Fri, 27 Sep 2019 14:22:50 -0700 Subject: [PATCH 6/6] updated configure.ac python3 argument help line to be more specific --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index fdd04f16..07c8150a 100644 --- a/configure.ac +++ b/configure.ac @@ -57,7 +57,7 @@ fi AC_ARG_ENABLE([python3], [AS_HELP_STRING([--enable-python3], - [enable python3 default is python2])], + [sets python3 flag for building packages])], [enable_python3=yes], [enable_python3=no]) AM_CONDITIONAL([PYTHON3], [test "x$enable_python3" == "xyes"])