]> 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)
committerKevin P. Fleming <kevin@km6g.us>
Fri, 13 Nov 2020 22:35:34 +0000 (17:35 -0500)
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.

39 files changed:
.circleci/config.yml
.github/actions/spell-check/expect.txt
.github/workflows/codeql-analysis.yml
.travis.yml
Dockerfile-recursor
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.rpmbuild
builder-support/dockerfiles/Dockerfile.target.centos-6
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 [deleted file]
pdns/Makefile.am
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 6051037a8b1104c960a543dc55cf1594b31d5017..fcbc4e6eba1c06f678c3dd81286a58873380bb99 100644 (file)
@@ -222,7 +222,7 @@ commands:
               libsodium23 \
               patch \
               protobuf-compiler \
-              virtualenv
+              python3-venv
 
   install-ixfrdist-deps:
     description: "Install all libraries needed for testing ixfrdist"
@@ -235,7 +235,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
@@ -274,7 +274,7 @@ commands:
               sqlite3 \
               systemd \
               unixodbc-dev \
-              virtualenv \
+              python3-venv \
               wget
 
   add-auth-repo:
@@ -376,7 +376,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
@@ -919,7 +919,7 @@ jobs:
           password: $DOCKERHUB_PASSWORD
     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
@@ -965,7 +965,7 @@ jobs:
             protobuf-compiler \
             ragel \
             systemd \
-            virtualenv
+            python3-venv
       - get-workspace
       - run:
           name: autoconf
@@ -1016,7 +1016,7 @@ jobs:
           password: $DOCKERHUB_PASSWORD
     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
@@ -1253,7 +1253,7 @@ jobs:
           password: $DOCKERHUB_PASSWORD
     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:
@@ -1431,7 +1431,7 @@ jobs:
             pkg-config \
             protobuf-compiler \
             ragel \
-            virtualenv
+            python3-venv
       - install-coverity-tools
       - checkout-shallow
       - run:
@@ -1508,7 +1508,7 @@ jobs:
             pkg-config \
             protobuf-compiler \
             ragel \
-            virtualenv
+            python3-venv
       - install-coverity-tools
       - checkout-shallow
       - run:
@@ -1588,7 +1588,7 @@ jobs:
             protobuf-compiler \
             ragel \
             systemd \
-            virtualenv
+            python3-venv
       - get-workspace
       - run:
           name: autoconf
index 39389b9a0ee6fe8102f5685f855057b1f5c4dd1a..344c0cd4319be3d158626456ab6f1d7b915fc4c2 100644 (file)
@@ -2104,7 +2104,7 @@ versionchanged
 versionmodified
 vh
 viewcode
-virtualenv
+venv
 virtualized
 visitedlinkcolor
 vixie
index 2020fcc15d612983bf33e77ffd66caf56519defa..491323b3e717e42ed87967f050afd526335dd743 100644 (file)
@@ -33,11 +33,10 @@ jobs:
     - run: git checkout HEAD^2
       if: ${{ github.event_name == 'pull_request' }}
 
-    # Python and virtualenv are required for building the Authoritative server
+    # Python is required for building the Authoritative server
     - uses: actions/setup-python@v2
       with:
-        python-version: '2.7'
-    - run: pip install virtualenv
+        python-version: '3.8'
 
     # Initializes the CodeQL tools for scanning.
     - name: Initialize CodeQL
@@ -64,9 +63,12 @@ jobs:
     #    and modify them (or add more) to build your code if your project
     #    uses a compiled language
 
+    - name: Update repository metadata
+      run: |
+        sudo apt-get update
     - name: Install dependencies
       run: |
-        sudo apt-get update && sudo apt-get --no-install-recommends install -qq -y \
+        sudo apt-get -qq -y --no-install-recommends install \
                 bison \
                 default-libmysqlclient-dev \
                 flex \
index bd61769385c5b406df7318f88323e4f20550b87a..7ae90caac7b636bea7e63001a094cb002547ca60 100644 (file)
@@ -24,10 +24,7 @@ before_script:
   - export CXXFLAGS=-O0
   - export OPTFLAGS=-O0
   - sudo apt-get -qq update
-  # you can remove this when updating dist to something newer than trusty
-  - pyenv global 2.7
-  # needed for virtualenv to use the pyenv python
-  - pip install virtualenv
+  - pyenv global 3.6
 
 script:
   - ./build-scripts/travis.sh
index 3f1a487237aff41e907597acb155783fc5b842a6..e9ed21faeac87d4acdc460a0b9e0b74df3bc9ffd 100644 (file)
@@ -37,7 +37,7 @@ ARG DOCKER_FAKE_RELEASE=NO
 ENV DOCKER_FAKE_RELEASE ${DOCKER_FAKE_RELEASE}
 
 # Manpage deps
-# RUN apt-get install -y virtualenv && apt-get clean
+# RUN apt-get install -y python3-venv && apt-get clean
 
 # Manpage prevent
 RUN touch pdns_recursor.1 rec_control.1 # avoid installing pandoc
index 6c400262d92425458d2b4fc36edc618f6d6c287f..218fc581aecbe64b1c42d34c26455448de2a2a74 100644 (file)
--- a/README.md
+++ b/README.md
@@ -54,7 +54,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:
@@ -66,7 +66,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 libsqlite3-dev
+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/
index f3fd7a0f291d3cfb30bd9da181d804965fc41316..25e252ac8d4e58c892258c236e07518c6e93a66f 100644 (file)
@@ -1,8 +1,6 @@
 FROM dist-base as package-builder
 RUN touch /var/lib/rpm/* && \
-    yum install -y rpm-build rpmdevtools /usr/bin/python3 && \
-    yum groupinstall -y "Development Tools" && \
-    rpmdev-setuptree
+    yum install -y rpm-build rpmdevtools python3 "@Development Tools"
 
 RUN mkdir /dist /pdns
 WORKDIR /pdns
index fd89ccd9f20ae48316bc44cdb24a01be96b3f46c..38a129078313b0d5a7190e576a97d339166251c9 100644 (file)
@@ -10,6 +10,10 @@ RUN touch /var/lib/rpm/* && yum clean all
 RUN touch /var/lib/rpm/* && yum install -y --verbose epel-release centos-release-scl-rh && \
     yum install -y --nogpgcheck devtoolset-7-gcc-c++
 
+# Enable IUS Community Repository (for Python 3.6)
+RUN curl https://setup.ius.io/ | sh
+RUN touch /var/lib/rpm/* && yum install -y --verbose python36 && ln -s python36 /usr/bin/python3
+
 # Do the actual rpm build
 @INCLUDE Dockerfile.rpmbuild
 
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 88293d1ad07214eabeb5e85777acffe03eeb78b6..02b76692c41832fc382a2b3be864f67133eae72e 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"])
+])
diff --git a/m4/pdns_check_virtualenv.m4 b/m4/pdns_check_virtualenv.m4
deleted file mode 100644 (file)
index 873cde5..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_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"])
-  AM_CONDITIONAL([HAVE_API_SWAGGER_JSON], [test -e "$srcdir/pdns/api-swagger.json"])
-])
index d85f1d7050c1bddcc69abfd18ea1fca516a6bca5..668c1fd90ab3b012108f74e634a1a6c564429a8f 100644 (file)
@@ -54,7 +54,8 @@ EXTRA_DIST = \
        api-swagger.yaml \
        api-swagger.json \
        requirements.txt \
-       incfiles
+       incfiles \
+       convert-yaml-to-json.py
 
 BUILT_SOURCES = \
        bind-dnssec.schema.sqlite3.sql.h \
@@ -80,18 +81,18 @@ CLEANFILES = \
 api-swagger.yaml: $(wildcard ../docs/http-api/swagger/authoritative-api-swagger.yaml)
        cp $< $@
 
-if HAVE_VIRTUALENV
+if HAVE_VENV
 .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
 
 api-swagger.json: api-swagger.yaml .venv
-       .venv/bin/python -c "import sys, json, yaml; y = yaml.safe_load(sys.stdin.read()); json.dump(y, sys.stdout, indent=2, separators=(',', ': '))" < $< > $@
-else # if HAVE_VIRTUALENV
+       .venv/bin/python convert-yaml-to-json.py $< $@
+else # if HAVE_VENV
 if !HAVE_API_SWAGGER_JSON
 api-swagger.json:
-       echo "You need virtualenv to generate the JSON API document"
+       echo "You need Python 3 and the 'venv' module to generate the JSON API document"
        exit 1
 endif
 endif
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 1bea3b333010735a8452785d8bda01b8e1e0ce34..39af1b0a9835ae39bcc7f4f00ed92ce753ab24b1 100644 (file)
@@ -390,15 +390,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
@@ -420,17 +420,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 898635add7207799b6591216e892bf0825441e68..6e5a0e8e540f9b0add1c2d0951df6be62581caca 100644 (file)
@@ -468,15 +468,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
@@ -498,17 +498,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 d5de20b8455337ca07ad8724180fba3d5058f577..f5f525ad5ea5ed394fe58eef6b3d9f38b0844528 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