]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Use Python 3 in build system
authorKevin P. Fleming <kevin@km6g.us>
Fri, 13 Nov 2020 22:35:34 +0000 (17:35 -0500)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Wed, 6 Oct 2021 08:12:23 +0000 (10:12 +0200)
The various tasks in the build system which use Python
will now use Python 3 (3.6 or later) and the 'venv' module,
instead of the 'virtualenv' tool which was primarily used
with Python 2.7.

(cherry picked from commit 9850825187bf0c493ca5960a4cd84d50ee75c265)

36 files changed:
.circleci/config.yml
.github/actions/spell-check/expect.txt
.github/workflows/codeql-analysis.yml [new file with mode: 0644]
.travis.yml [new file with mode: 0644]
README.md
builder-support/dockerfiles/Dockerfile.authoritative
builder-support/dockerfiles/Dockerfile.debbuild-prepare
builder-support/dockerfiles/Dockerfile.dnsdist
builder-support/dockerfiles/Dockerfile.recursor
builder-support/dockerfiles/Dockerfile.target.centos-6 [new file with mode: 0644]
builder-support/dockerfiles/Dockerfile.target.docs
configure.ac
docs/Makefile.am
docs/Makefile.sphinx
docs/appendices/compiling.rst
m4/ax_python_module.m4 [new file with mode: 0644]
m4/pdns_check_python_venv.m4 [new file with mode: 0644]
m4/pdns_check_virtualenv.m4
pdns/convert-yaml-to-json.py [new file with mode: 0644]
pdns/dnsdistdist/Makefile.am
pdns/dnsdistdist/configure.ac
pdns/dnsdistdist/docs/Makefile.sphinx
pdns/dnsdistdist/m4/ax_python_module.m4 [new symlink]
pdns/dnsdistdist/m4/pdns_check_python_venv.m4 [new symlink]
pdns/dnsdistdist/m4/pdns_check_virtualenv.m4 [deleted file]
pdns/recursordist/Makefile.am
pdns/recursordist/configure.ac
pdns/recursordist/docs/Makefile.sphinx
pdns/recursordist/m4/ax_python_module.m4 [new symlink]
pdns/recursordist/m4/pdns_check_python_venv.m4 [new symlink]
pdns/recursordist/m4/pdns_check_virtualenv.m4 [deleted file]
regression-tests.api/runtests
regression-tests.auth-py/runtests
regression-tests.dnsdist/runtests
regression-tests.ixfrdist/runtests
regression-tests.recursor-dnssec/runtests

index fc67d963c4a55338ad1516e21ddc332a1c508c30..07175813c66cf0ce60d4834f7157e207595e81a6 100644 (file)
@@ -221,7 +221,7 @@ commands:
               libsystemd0 \
               libsodium23 \
               protobuf-compiler \
-              virtualenv
+              python3-venv
 
   install-ixfrdist-deps:
     description: "Install all libraries needed for testing ixfrdist"
@@ -234,7 +234,7 @@ commands:
               libboost-all-dev \
               libsystemd0 \
               libyaml-cpp0.6 \
-              virtualenv
+              python3-venv
 
   install-auth-dev-deps:
     description: Install all packages needed to build the auth
@@ -273,7 +273,7 @@ commands:
               sqlite3 \
               systemd \
               unixodbc-dev \
-              virtualenv \
+              python3-venv \
               wget
 
   add-auth-repo:
@@ -375,7 +375,7 @@ commands:
             pkg-config \
             ragel \
             rsync \
-            virtualenv
+            python3-venv
             if [ "${CIRCLE_PROJECT_USERNAME}" = "PowerDNS" -a "${CIRCLE_PROJECT_REPONAME}" = "pdns" -a "${CIRCLE_BRANCH}" = "master" ]; then
               apt-get update && apt-get -qq -y install \
                 texlive-full
@@ -851,7 +851,7 @@ jobs:
       - image: debian:buster
     steps:
       - auth-regress-setup
-      - run: apt-get -y -qq install virtualenv sqlite3
+      - run: apt-get -y -qq install python3-venv sqlite3
       - run:
           name: Run API tests
           workdir: ~/project/regression-tests.api
@@ -894,7 +894,7 @@ jobs:
             protobuf-compiler \
             ragel \
             systemd \
-            virtualenv
+            python3-venv
       - get-workspace
       - run:
           name: autoconf
@@ -942,7 +942,7 @@ jobs:
       - image: debian:buster
     steps:
       - add-auth-repo
-      - run: apt-get --no-install-recommends install -qq -y pdns-server pdns-backend-bind pdns-tools daemontools authbind jq libfaketime lua-posix lua-socket moreutils bc virtualenv protobuf-compiler
+      - run: apt-get --no-install-recommends install -qq -y pdns-server pdns-backend-bind pdns-tools daemontools authbind jq libfaketime lua-posix lua-socket moreutils bc python3-venv protobuf-compiler
       - install-recursor-deps
       - run:
           name: Set up authbind
@@ -1173,7 +1173,7 @@ jobs:
       - image: debian:buster
     steps:
       - add-auth-repo
-      - run: apt-get --no-install-recommends install -qq -y virtualenv pdns-tools
+      - run: apt-get --no-install-recommends install -qq -y python3-venv pdns-tools
       - install-recursor-deps
       - get-workspace
       - run:
@@ -1327,7 +1327,7 @@ jobs:
             pkg-config \
             protobuf-compiler \
             ragel \
-            virtualenv
+            python3-venv
       - install-coverity-tools
       - checkout-shallow
       - run:
@@ -1401,7 +1401,7 @@ jobs:
             pkg-config \
             protobuf-compiler \
             ragel \
-            virtualenv
+            python3-venv
       - install-coverity-tools
       - checkout-shallow
       - run:
@@ -1478,7 +1478,7 @@ jobs:
             protobuf-compiler \
             ragel \
             systemd \
-            virtualenv
+            python3-venv
       - get-workspace
       - run:
           name: autoconf
index af9ce8f5d614a9aa706796aff651451ed92e74cb..152c2032ee2fd4f1b37fe17c60d7ec119fe0ab89 100644 (file)
@@ -2087,7 +2087,7 @@ versionchanged
 versionmodified
 vh
 viewcode
-virtualenv
+venv
 virtualized
 visitedlinkcolor
 vixie
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..e69de29
index 7fedb7a197ae370b3c6fd29fb1325d7b736f3c8f..72524c2c05b0fe3ad591e1e26491f2f40d21210f 100644 (file)
--- a/README.md
+++ b/README.md
@@ -48,7 +48,7 @@ compiler with C++-2011 support.
 On Debian 9, the following is useful:
 
 ```sh
-apt install g++ libboost-all-dev libtool make pkg-config default-libmysqlclient-dev libssl-dev virtualenv libluajit-5.1-dev
+apt install g++ libboost-all-dev libtool make pkg-config default-libmysqlclient-dev libssl-dev libluajit-5.1-dev python3-venv
 ```
 
 When building from git, the following packages are also required:
@@ -60,7 +60,7 @@ apt install autoconf automake ragel bison flex
 For Ubuntu 18.04 (Bionic Beaver), the following packages should be installed:
 
 ```sh
-apt install libcurl4-openssl-dev luajit lua-yaml-dev libyaml-cpp-dev libtolua-dev lua5.3 autoconf automake ragel bison flex g++ libboost-all-dev libtool make pkg-config libssl-dev virtualenv lua-yaml-dev libyaml-cpp-dev libluajit-5.1-dev libcurl4 gawk
+apt install libcurl4-openssl-dev luajit lua-yaml-dev libyaml-cpp-dev libtolua-dev lua5.3 autoconf automake ragel bison flex g++ libboost-all-dev libtool make pkg-config libssl-dev lua-yaml-dev libyaml-cpp-dev libluajit-5.1-dev libcurl4 gawk libsqlite3-dev python3-venv
 # For DNSSEC ed25519 (algorithm 15) support with --with-libsodium
 apt install libsodium-dev
 # If using the gmysql (Generic MySQL) backend
index 3bc8231c5496967cee3c6756d7c74cb01605bce4..d1128a75406f289025fef5948e825cd261250cff 100644 (file)
@@ -2,7 +2,7 @@ FROM alpine:3.10 as pdns-authoritative
 ARG BUILDER_CACHE_BUSTER=
 
 RUN apk add --no-cache gcc g++ make tar autoconf automake protobuf-dev lua-dev \
-                       libtool file boost-dev curl openssl-dev ragel py-virtualenv \
+                       libtool file boost-dev curl openssl-dev ragel python3 \
                        flex bison git
 
 # the pdns/ dir is a bit broad, but who cares :)
index 7bbbc37ed84b53c2a3db751861511ae08cb0a5a4..0dd366838f8eded590bfac2e909ff33a22946f2d 100644 (file)
@@ -1,6 +1,6 @@
 FROM dist-base as package-builder
 ARG APT_URL
-RUN DEBIAN_FRONTEND=noninteractive apt-get -y install devscripts dpkg-dev build-essential python3 equivs
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install devscripts dpkg-dev build-essential python3-venv equivs
 
 RUN mkdir /dist /pdns
 WORKDIR /pdns
index 2295d361f65a56fbba8ee9a8f1d8b74bf338436a..a6ba2f3421213c1e9a5c25f10449e497162ccfef 100644 (file)
@@ -2,7 +2,7 @@ FROM alpine:3.10 as dnsdist
 ARG BUILDER_CACHE_BUSTER=
 
 RUN apk add --no-cache gcc g++ make tar autoconf automake protobuf-dev lua-dev \
-                       libtool file boost-dev ragel py-virtualenv git libedit-dev
+                       libtool file boost-dev ragel python3 git libedit-dev
 
 ADD builder/helpers/set-configure-ac-version.sh /dnsdist/builder/helpers/
 ADD COPYING /dnsdist/
index ab1ec13211024c9c3155602db1f9c3df4ca4e92c..2a2db79e88f88054ffeeb7814c1f18562a06fb60 100644 (file)
@@ -2,7 +2,7 @@ FROM alpine:3.10 as pdns-recursor
 ARG BUILDER_CACHE_BUSTER=
 
 RUN apk add --no-cache gcc g++ make tar autoconf automake protobuf-dev lua-dev \
-                       libtool file boost-dev curl openssl-dev ragel py-virtualenv \
+                       libtool file boost-dev curl openssl-dev ragel python3 \
                        flex bison git
 
 ADD COPYING NOTICE /pdns-recursor/
diff --git a/builder-support/dockerfiles/Dockerfile.target.centos-6 b/builder-support/dockerfiles/Dockerfile.target.centos-6
new file mode 100644 (file)
index 0000000..e69de29
index 8ece113aa96ef9c9f943e7895885971dec0bd218..528ad6505c3d02b4ec8b88421f6ba265080d4504 100644 (file)
@@ -11,7 +11,7 @@ RUN apt-get update && apt-get -y dist-upgrade && apt-get -y --no-install-recomme
     texlive-font-utils \
     texlive-fonts-extra \
     texlive-latex-extra \
-    virtualenv
+    python3-venv
 
 RUN mkdir -p /pdns /dist /sdist
 
index 077615306909553428d34de66ae435407cee5326..56179b6d0fa106692de279fd8dcbf1b4d0fa501a 100644 (file)
@@ -126,7 +126,22 @@ PDNS_ENABLE_FUZZ_TARGETS
 
 PDNS_WITH_SQLITE3
 
-PDNS_CHECK_VIRTUALENV
+PDNS_CHECK_PYTHON_VENV
+
+AM_CONDITIONAL([HAVE_API_SWAGGER_JSON], [test -e "$srcdir/pdns/api-swagger.json"])
+AM_COND_IF([HAVE_API_SWAGGER_JSON],[],[
+  AM_COND_IF([HAVE_VENV],[],[
+    AC_MSG_ERROR([Python 3 and/or venv module are not available, Authoritative Server cannot be built.])
+  ])
+])
+
+AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/docs/pdns_server.1"])
+AM_COND_IF([HAVE_MANPAGES],[],[
+  AM_COND_IF([HAVE_VENV],[],[
+    AC_MSG_WARN([Python 3 and/or venv module are not available, documentation will not be built.])
+  ])
+])
+
 PDNS_FROM_GIT
 
 dnl Checks for library functions.
index c428e069db0cf20af7600580de00650ad0840fbb..3a2954be5f69711bc868aaaa19d18fa5f253cc9e 100644 (file)
@@ -59,7 +59,7 @@ man_MANS = $(MANPAGES_INSTALL)
 
 EXTRA_DIST = $(MANPAGES_DIST)
 
-if HAVE_VIRTUALENV
+if HAVE_VENV
 if !HAVE_MANPAGES
 $(MANPAGES_DIST): %: mans/.complete manpages/%.rst
        mv "$(<D)/$@" "$@" && rm -f "$<"
@@ -73,8 +73,8 @@ mans/.complete: .venv
        rm -rf "$(@D).tmp"
 
 .venv: requirements.txt
-       virtualenv .venv
-       .venv/bin/pip install -U pip setuptools setuptools-git
+       $(PYTHON) -m venv .venv
+       .venv/bin/pip install -U pip setuptools setuptools-git wheel
        .venv/bin/pip install -r requirements.txt
 
 .NOTPARALLEL: \
@@ -109,17 +109,17 @@ upload-docs: all-docs
        rsync -crv --no-p --chmod=g=rwX --exclude '*~' ./html-docs.tar.bz2 web1.powerdns.com:/srv/www/doc.powerdns.com/authoritative/
        rsync -crv --no-p --chmod=g=rwX --exclude '*~' ./PowerDNS-Authoritative.pdf web1.powerdns.com:/srv/www/doc.powerdns.com/authoritative/
 
-else # if HAVE_VIRTUALENV
+else # if HAVE_VENV
 $(MANPAGES_DIST):
-       echo "You need virtualenv to generate the manpages"
+       @echo "You need Python 3 and the 'venv' module to generate the manpages"
        exit 1
 
 PowerDNS-Authoritative.pdf:
-       echo "You need virtualenv to generate the PDF"
+       @echo "You need Python 3 and the 'venv' module to generate the PDF"
        exit 1
 
 html-docs:
-       echo "You need virtualenv to generate the HTML docs"
+       @echo "You need Python 3 and the 'venv' module to generate the HTML docs"
        exit 1
 endif
 
index 10498de5e845d1cf5dc4b6704f6508adcc054e15..fe0fbb180e0beb1e2219e56cea2f9200e3938c81 100644 (file)
@@ -20,8 +20,8 @@ help: .venv
        @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
 
 .venv:
-       virtualenv .venv
-       .venv/bin/pip install -U pip setuptools setuptools-git
+       python3 -m venv .venv
+       .venv/bin/pip install -U pip setuptools setuptools-git wheel
        .venv/bin/pip install -r requirements.txt
 
 
index a29d768bd7cef5b91c8291422e0d1b909dceaf8c..4a2ccc6135a83ac6662b75e2ff1de1299dd90fa5 100644 (file)
@@ -45,12 +45,12 @@ By default, the PowerDNS Authoritative Server requires the following libraries a
 * `Boost <http://boost.org/>`_ 1.35 or newer
 * `OpenSSL <https://openssl.org>`_
 
-To build from git, the following dependencies are also required:
+To build from a Git repository clone, the following dependencies are also required:
 
 * `ragel <http://www.colm.net/open-source/ragel/>`_
 * `bison <https://www.gnu.org/software/bison/>`_
 * `flex <https://github.com/westes/flex>`_
-* `virtualenv <https://pypi.python.org/pypi/virtualenv>`_
+* `Python <https://python.org>`_ 3.6 or newer, with the 'venv' package
 
 Optional dependencies
 ---------------------
diff --git a/m4/ax_python_module.m4 b/m4/ax_python_module.m4
new file mode 100644 (file)
index 0000000..f0f873d
--- /dev/null
@@ -0,0 +1,56 @@
+# ===========================================================================
+#     https://www.gnu.org/software/autoconf-archive/ax_python_module.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PYTHON_MODULE(modname[, fatal, python])
+#
+# DESCRIPTION
+#
+#   Checks for Python module.
+#
+#   If fatal is non-empty then absence of a module will trigger an error.
+#   The third parameter can either be "python" for Python 2 or "python3" for
+#   Python 3; defaults to Python 3.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Andrew Collier
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 9
+
+AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE])
+AC_DEFUN([AX_PYTHON_MODULE],[
+    if test -z $PYTHON;
+    then
+        if test -z "$3";
+        then
+            PYTHON="python3"
+        else
+            PYTHON="$3"
+        fi
+    fi
+    PYTHON_NAME=`basename $PYTHON`
+    AC_MSG_CHECKING($PYTHON_NAME module: $1)
+    $PYTHON -c "import $1" 2>/dev/null
+    if test $? -eq 0;
+    then
+        AC_MSG_RESULT(yes)
+        eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
+    else
+        AC_MSG_RESULT(no)
+        eval AS_TR_CPP(HAVE_PYMOD_$1)=no
+        #
+        if test -n "$2"
+        then
+            AC_MSG_ERROR(failed to find required module $1)
+            exit 1
+        fi
+    fi
+])
diff --git a/m4/pdns_check_python_venv.m4 b/m4/pdns_check_python_venv.m4
new file mode 100644 (file)
index 0000000..41830b2
--- /dev/null
@@ -0,0 +1,9 @@
+AC_DEFUN([PDNS_CHECK_PYTHON_VENV], [
+  dnl Check for optional Python, at least version 3.6.
+  AM_PATH_PYTHON([3.6],,[:])
+  dnl Check for Python venv module
+  AS_IF([test "${PYTHON}" != ":"], [
+    AX_PYTHON_MODULE([venv],[])
+  ])
+  AM_CONDITIONAL([HAVE_VENV], [test "x${HAVE_PYMOD_VENV}" = "xyes"])
+])
index 498cff7737c1e9a2a297c1fbcc106d765f984311..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,12 +0,0 @@
-AC_DEFUN([PDNS_CHECK_VIRTUALENV], [
-  AC_CHECK_PROG([VIRTUALENV], [virtualenv], [virtualenv], [no])
-
-  AS_IF([test "x$VIRTUALENV" = "xno"], [
-    AS_IF([test ! -f "$srcdir/pdns_server.1"],
-      [AC_MSG_WARN([virtualenv is missing, unable to build manpages.])]
-    )
-  ])
-  AM_CONDITIONAL([HAVE_VIRTUALENV], [test "x$VIRTUALENV" != "xno"])
-  AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/docs/pdns_server.1"])
-])
-
diff --git a/pdns/convert-yaml-to-json.py b/pdns/convert-yaml-to-json.py
new file mode 100644 (file)
index 0000000..ca33e9f
--- /dev/null
@@ -0,0 +1,5 @@
+import sys, json, yaml
+
+with open(sys.argv[1], mode='r', encoding='utf-8') as f_in:
+    with open(sys.argv[2], mode='w', encoding='utf-8') as f_out:
+        json.dump(yaml.safe_load(f_in.read()), f_out, indent=2, separators=(',', ': '))
index 7143be30e38392a174da91023be0aa608265397e..990a07bfa3d33100d05dd80b00af1f36e258b849 100644 (file)
@@ -380,15 +380,15 @@ MANPAGES=dnsdist.1
 
 dist_man_MANS=$(MANPAGES)
 
-if HAVE_VIRTUALENV
+if HAVE_VENV
 if !HAVE_MANPAGES
 $(MANPAGES): %: docs/manpages/%.rst .venv
        $(AM_V_GEN).venv/bin/python -msphinx -b man docs . $<
 endif # if !HAVE_MANPAGES
 
 .venv: docs/requirements.txt
-       virtualenv .venv
-       .venv/bin/pip install -U pip setuptools setuptools-git
+       $(PYTHON) -m venv .venv
+       .venv/bin/pip install -U pip setuptools setuptools-git wheel
        .venv/bin/pip install -r $<
 
 latex/dnsdist.pdf: docs/** .venv
@@ -410,17 +410,17 @@ upload-docs: all-docs
        rsync -crv --no-p --chmod=g=rwX --exclude '*~' ./html-docs.tar.bz2 web1.powerdns.com:/srv/www/dnsdist.org
        rsync -crv --no-p --chmod=g=rwX --exclude '*~' ./dnsdist.pdf web1.powerdns.com:/srv/www/dnsdist.org
 
-else # if HAVE_VIRTUALENV
+else # if HAVE_VENV
 $(MANPAGES):
-       @echo "You need virtualenv to generate the manpages"
+       @echo "You need Python 3 and the 'venv' module to generate the manpages"
        exit 1
 
 html-docs: %: docs/manpages/%.rst .venv
-       @echo "You need virtualenv to generate the HTML documentation"
+       @echo "You need Python 3 and the 'venv' module to generate the HTML docs"
        exit 1
 
 dnsdist.pdf:
-       @echo "You need virtualenv to generate the pdf documentation"
+       @echo "You need Python 3 and the 'venv' module to generate the PDF"
        exit 1
 endif
 
index b09a7e02b15b400db7a480a937220c22193cdc5f..62850326e83a759b00909bfa308b64706ed5c2ac 100644 (file)
@@ -121,7 +121,14 @@ AS_IF([test "x$enable_hardening" != "xno"], [
 
 PDNS_ENABLE_SANITIZERS
 
-PDNS_CHECK_VIRTUALENV
+PDNS_CHECK_PYTHON_VENV
+
+AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/dnsdist.1"])
+AM_COND_IF([HAVE_MANPAGES],[],[
+  AM_COND_IF([HAVE_VENV],[],[
+    AC_MSG_WARN([Python 3 and/or venv module are not available, documentation will not be built.])
+  ])
+])
 
 LDFLAGS="$RELRO_LDFLAGS $LDFLAGS"
 
index 4c16b320f362d73089a8f4dd088ca50a8e150614..fc4234cf7b7f870799a0fc1cba74709244692a3b 100644 (file)
@@ -20,8 +20,8 @@ help: .venv
        @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
 
 .venv:
-       virtualenv .venv
-       .venv/bin/pip install -U pip setuptools setuptools-git
+       python3 -m venv .venv
+       .venv/bin/pip install -U pip setuptools setuptools-git wheel
        .venv/bin/pip install -r requirements.txt
 
 
diff --git a/pdns/dnsdistdist/m4/ax_python_module.m4 b/pdns/dnsdistdist/m4/ax_python_module.m4
new file mode 120000 (symlink)
index 0000000..2e5ceca
--- /dev/null
@@ -0,0 +1 @@
+../../../m4/ax_python_module.m4
\ No newline at end of file
diff --git a/pdns/dnsdistdist/m4/pdns_check_python_venv.m4 b/pdns/dnsdistdist/m4/pdns_check_python_venv.m4
new file mode 120000 (symlink)
index 0000000..35efa28
--- /dev/null
@@ -0,0 +1 @@
+../../../m4/pdns_check_python_venv.m4
\ No newline at end of file
diff --git a/pdns/dnsdistdist/m4/pdns_check_virtualenv.m4 b/pdns/dnsdistdist/m4/pdns_check_virtualenv.m4
deleted file mode 100644 (file)
index 214d450..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-AC_DEFUN([PDNS_CHECK_VIRTUALENV], [
-  AC_CHECK_PROG([VIRTUALENV], [virtualenv], [virtualenv], [no])
-
-  AS_IF([test "x$VIRTUALENV" = "xno"], [
-    AS_IF([test ! -f "$srcdir/dnsdist.1"],
-      [AC_MSG_WARN([virtualenv is missing, unable to build manpages.])]
-    )
-  ])
-  AM_CONDITIONAL([HAVE_VIRTUALENV], [test "x$VIRTUALENV" != "xno"])
-  AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/dnsdist.1"])
-])
-
index 036bdccd817cffcd06c8cc2f6bea9f13ecf5f384..4adc9e52d73a7f80405c02d9646b073c441d789d 100644 (file)
@@ -465,15 +465,15 @@ MANPAGES=pdns_recursor.1 \
 
 dist_man_MANS=$(MANPAGES)
 
-if HAVE_VIRTUALENV
+if HAVE_VENV
 if !HAVE_MANPAGES
 $(MANPAGES): %: docs/manpages/%.rst .venv
        .venv/bin/python -msphinx -b man docs . $<
 endif # if !HAVE_MANPAGES
 
 .venv: docs/requirements.txt
-       virtualenv .venv
-       .venv/bin/pip install -U pip setuptools setuptools-git
+       $(PYTHON) -m venv .venv
+       .venv/bin/pip install -U pip setuptools setuptools-git wheel
        .venv/bin/pip install -r docs/requirements.txt
 
 html-docs: docs/** .venv
@@ -495,17 +495,17 @@ upload-docs: all-docs
        rsync -crv --no-p --chmod=g=rwX --exclude '*~' ./html-docs.tar.bz2 web1.powerdns.com:/srv/www/doc.powerdns.com/recursor/
        rsync -crv --no-p --chmod=g=rwX --exclude '*~' ./PowerDNS-Recursor.pdf web1.powerdns.com:/srv/www/doc.powerdns.com/recursor/
 
-else # if HAVE_VIRTUALENV
+else # if HAVE_VENV
 $(MANPAGES):
-       echo "You need virtualenv to generate the manpages"
+       @echo "You need Python 3 and the 'venv' module to generate the manpages"
        exit 1
 
 PowerDNS-Recursor.pdf:
-       echo "You need virtualenv to generate the PDF"
+       @echo "You need Python 3 and the 'venv' module to generate the PDF"
        exit 1
 
 html-docs:
-       echo "You need virtualenv to generate the HTML docs"
+       @echo "You need Python 3 and the 'venv' module to generate the HTML docs"
        exit 1
 endif
 
index 0b756510ae58af44ff2e17564d14162a74016346..55f0597138fe1079abab6d6a0aac0aac81fee740 100644 (file)
@@ -140,7 +140,15 @@ AX_AVAILABLE_SYSTEMD
 AX_CHECK_SYSTEMD_FEATURES
 AM_CONDITIONAL([HAVE_SYSTEMD], [ test x"$systemd" = "xy" ])
 PDNS_WITH_SERVICE_USER([pdns-recursor])
-PDNS_CHECK_VIRTUALENV
+
+PDNS_CHECK_PYTHON_VENV
+
+AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/pdns_recursor.1"])
+AM_COND_IF([HAVE_MANPAGES],[],[
+  AM_COND_IF([HAVE_VENV],[],[
+    AC_MSG_WARN([Python 3 and/or venv module are not available, documentation will not be built.])
+  ])
+])
 
 AC_SUBST(LIBS)
 
index 7e5c1f3e9a92382e5e8c3420bd4c208762982ce8..c093fd2ef0feed7ef35ea7b4308f511b57439f27 100644 (file)
@@ -20,8 +20,8 @@ help: .venv
        @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
 
 .venv:
-       virtualenv .venv
-       .venv/bin/pip install -U pip setuptools setuptools-git
+       python3 -m venv .venv
+       .venv/bin/pip install -U pip setuptools setuptools-git wheel
        .venv/bin/pip install -r requirements.txt
 
 
diff --git a/pdns/recursordist/m4/ax_python_module.m4 b/pdns/recursordist/m4/ax_python_module.m4
new file mode 120000 (symlink)
index 0000000..2e5ceca
--- /dev/null
@@ -0,0 +1 @@
+../../../m4/ax_python_module.m4
\ No newline at end of file
diff --git a/pdns/recursordist/m4/pdns_check_python_venv.m4 b/pdns/recursordist/m4/pdns_check_python_venv.m4
new file mode 120000 (symlink)
index 0000000..35efa28
--- /dev/null
@@ -0,0 +1 @@
+../../../m4/pdns_check_python_venv.m4
\ No newline at end of file
diff --git a/pdns/recursordist/m4/pdns_check_virtualenv.m4 b/pdns/recursordist/m4/pdns_check_virtualenv.m4
deleted file mode 100644 (file)
index 8f735b2..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-AC_DEFUN([PDNS_CHECK_VIRTUALENV], [
-  AC_CHECK_PROG([VIRTUALENV], [virtualenv], [virtualenv], [no])
-
-  AS_IF([test "x$VIRTUALENV" = "xno"], [
-    AS_IF([test ! -f "$srcdir/pdns_recursor.1"],
-      [AC_MSG_WARN([virtualenv is missing, unable to build manpages.])]
-    )
-  ])
-  AM_CONDITIONAL([HAVE_VIRTUALENV], [test "x$VIRTUALENV" != "xno"])
-  AM_CONDITIONAL([HAVE_MANPAGES], [test -e "$srcdir/pdns_recursor.1"])
-])
-
index 56e5bf77b3bf763858e4a1dc29ad539256e6ed2a..9ef71c5cd7211836bdf36d78ed0347f6bd4bb2be 100755 (executable)
@@ -1,17 +1,7 @@
 #!/usr/bin/env bash
 
 if [ ! -d .venv ]; then
-  if [ -z "$PYTHON" ]; then
-    if [ ! -z "$(python3 --version | egrep '^Python 3.[6789]' 2>/dev/null)" ]; then
-      # found python3.6 or better
-      PYTHON=python3
-    else
-      # until we have better Linux distribution detection.
-      PYTHON=python2
-    fi
-  fi
-
-  virtualenv -p ${PYTHON} .venv
+  python3 -m venv .venv
 fi
 . .venv/bin/activate
 python -V
index 6c30ba8c6634b2fe3d102732ef0dd1405d76a4aa..5a251623c306ef522a5540f57ea5783979ffb6a8 100755 (executable)
@@ -1,10 +1,8 @@
 #!/usr/bin/env bash
 set -e
 
-readonly PYTHON=${PYTHON:-python2}
-
 if [ ! -d .venv ]; then
-    virtualenv -p ${PYTHON} .venv
+    python3 -m venv .venv
 fi
 
 . .venv/bin/activate
index 93543922c581364a9d7c3f3d8fccbccb771c30b7..a860fd782c73fb07c956463667a9e707443b29f2 100755 (executable)
@@ -2,17 +2,7 @@
 set -e
 
 if [ ! -d .venv ]; then
-  if [ -z "$PYTHON" ]; then
-    if [ ! -z "$(python3 --version | egrep '^Python 3.[6789]' 2>/dev/null)" ]; then
-      # found python3.6 or better
-      PYTHON=python3
-    else
-      # until we have better Linux distribution detection.
-      PYTHON=python2
-    fi
-  fi
-
-  virtualenv -p ${PYTHON} .venv
+  python3 -m venv .venv
 fi
 . .venv/bin/activate
 python -V
index 0bbf43915dd8432ba9392ab5acddeeb81b789de6..efcc4e250cf54aa97ac890e6a657326a82ff2060 100755 (executable)
@@ -2,17 +2,7 @@
 set -e
 
 if [ ! -d .venv ]; then
-  if [ -z "$PYTHON" ]; then
-    if [ ! -z "$(python3 --version | egrep '^Python 3.[6789]' 2>/dev/null)" ]; then
-      # found python3.6 or better
-      PYTHON=python3
-    else
-      # until we have better Linux distribution detection.
-      PYTHON=python2
-    fi
-  fi
-
-  virtualenv -p ${PYTHON} .venv
+  python3 -m venv .venv
 fi
 . .venv/bin/activate
 python -V
index b21a776e66fd773d153d5111756ab49fc97b5f12..08b0e5efad80405bbc4623ff098bf89087258078 100755 (executable)
@@ -1,9 +1,7 @@
 #!/bin/sh
 
-PYTHON=${PYTHON:-python2}
-
 if [ ! -d .venv ]; then
-       virtualenv -p ${PYTHON} .venv
+  python3 -m venv .venv
 fi
 . .venv/bin/activate
 python -V