From 9850825187bf0c493ca5960a4cd84d50ee75c265 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Fri, 13 Nov 2020 17:35:34 -0500 Subject: [PATCH] Use Python 3 in build system 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. --- .circleci/config.yml | 22 ++++---- .github/actions/spell-check/expect.txt | 2 +- .github/workflows/codeql-analysis.yml | 10 ++-- .travis.yml | 5 +- Dockerfile-recursor | 2 +- README.md | 4 +- .../dockerfiles/Dockerfile.authoritative | 2 +- .../dockerfiles/Dockerfile.debbuild-prepare | 2 +- .../dockerfiles/Dockerfile.dnsdist | 2 +- .../dockerfiles/Dockerfile.recursor | 2 +- .../dockerfiles/Dockerfile.rpmbuild | 4 +- .../dockerfiles/Dockerfile.target.centos-6 | 4 ++ .../dockerfiles/Dockerfile.target.docs | 2 +- configure.ac | 17 +++++- docs/Makefile.am | 14 ++--- docs/Makefile.sphinx | 4 +- docs/appendices/compiling.rst | 4 +- m4/ax_python_module.m4 | 56 +++++++++++++++++++ m4/pdns_check_python_venv.m4 | 9 +++ m4/pdns_check_virtualenv.m4 | 12 ---- pdns/Makefile.am | 15 ++--- pdns/convert-yaml-to-json.py | 5 ++ pdns/dnsdistdist/Makefile.am | 14 ++--- pdns/dnsdistdist/configure.ac | 9 ++- pdns/dnsdistdist/docs/Makefile.sphinx | 4 +- pdns/dnsdistdist/m4/ax_python_module.m4 | 1 + pdns/dnsdistdist/m4/pdns_check_python_venv.m4 | 1 + pdns/dnsdistdist/m4/pdns_check_virtualenv.m4 | 12 ---- pdns/recursordist/Makefile.am | 14 ++--- pdns/recursordist/configure.ac | 10 +++- pdns/recursordist/docs/Makefile.sphinx | 4 +- pdns/recursordist/m4/ax_python_module.m4 | 1 + .../recursordist/m4/pdns_check_python_venv.m4 | 1 + pdns/recursordist/m4/pdns_check_virtualenv.m4 | 12 ---- regression-tests.api/runtests | 12 +--- regression-tests.auth-py/runtests | 4 +- regression-tests.dnsdist/runtests | 12 +--- regression-tests.ixfrdist/runtests | 12 +--- regression-tests.recursor-dnssec/runtests | 4 +- 39 files changed, 181 insertions(+), 145 deletions(-) create mode 100644 m4/ax_python_module.m4 create mode 100644 m4/pdns_check_python_venv.m4 delete mode 100644 m4/pdns_check_virtualenv.m4 create mode 100644 pdns/convert-yaml-to-json.py create mode 120000 pdns/dnsdistdist/m4/ax_python_module.m4 create mode 120000 pdns/dnsdistdist/m4/pdns_check_python_venv.m4 delete mode 100644 pdns/dnsdistdist/m4/pdns_check_virtualenv.m4 create mode 120000 pdns/recursordist/m4/ax_python_module.m4 create mode 120000 pdns/recursordist/m4/pdns_check_python_venv.m4 delete mode 100644 pdns/recursordist/m4/pdns_check_virtualenv.m4 diff --git a/.circleci/config.yml b/.circleci/config.yml index 6051037a8b..fcbc4e6eba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index 39389b9a0e..344c0cd431 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -2104,7 +2104,7 @@ versionchanged versionmodified vh viewcode -virtualenv +venv virtualized visitedlinkcolor vixie diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2020fcc15d..491323b3e7 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -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 \ diff --git a/.travis.yml b/.travis.yml index bd61769385..7ae90caac7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Dockerfile-recursor b/Dockerfile-recursor index 3f1a487237..e9ed21faea 100644 --- a/Dockerfile-recursor +++ b/Dockerfile-recursor @@ -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 diff --git a/README.md b/README.md index 6c400262d9..218fc581ae 100644 --- 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 diff --git a/builder-support/dockerfiles/Dockerfile.authoritative b/builder-support/dockerfiles/Dockerfile.authoritative index 3bc8231c54..d1128a7540 100644 --- a/builder-support/dockerfiles/Dockerfile.authoritative +++ b/builder-support/dockerfiles/Dockerfile.authoritative @@ -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 :) diff --git a/builder-support/dockerfiles/Dockerfile.debbuild-prepare b/builder-support/dockerfiles/Dockerfile.debbuild-prepare index 7bbbc37ed8..0dd366838f 100644 --- a/builder-support/dockerfiles/Dockerfile.debbuild-prepare +++ b/builder-support/dockerfiles/Dockerfile.debbuild-prepare @@ -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 diff --git a/builder-support/dockerfiles/Dockerfile.dnsdist b/builder-support/dockerfiles/Dockerfile.dnsdist index 2295d361f6..a6ba2f3421 100644 --- a/builder-support/dockerfiles/Dockerfile.dnsdist +++ b/builder-support/dockerfiles/Dockerfile.dnsdist @@ -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/ diff --git a/builder-support/dockerfiles/Dockerfile.recursor b/builder-support/dockerfiles/Dockerfile.recursor index ab1ec13211..2a2db79e88 100644 --- a/builder-support/dockerfiles/Dockerfile.recursor +++ b/builder-support/dockerfiles/Dockerfile.recursor @@ -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.rpmbuild b/builder-support/dockerfiles/Dockerfile.rpmbuild index f3fd7a0f29..25e252ac8d 100644 --- a/builder-support/dockerfiles/Dockerfile.rpmbuild +++ b/builder-support/dockerfiles/Dockerfile.rpmbuild @@ -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 diff --git a/builder-support/dockerfiles/Dockerfile.target.centos-6 b/builder-support/dockerfiles/Dockerfile.target.centos-6 index fd89ccd9f2..38a1290783 100644 --- a/builder-support/dockerfiles/Dockerfile.target.centos-6 +++ b/builder-support/dockerfiles/Dockerfile.target.centos-6 @@ -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 diff --git a/builder-support/dockerfiles/Dockerfile.target.docs b/builder-support/dockerfiles/Dockerfile.target.docs index 8ece113aa9..528ad6505c 100644 --- a/builder-support/dockerfiles/Dockerfile.target.docs +++ b/builder-support/dockerfiles/Dockerfile.target.docs @@ -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 diff --git a/configure.ac b/configure.ac index 88293d1ad0..02b76692c4 100644 --- a/configure.ac +++ b/configure.ac @@ -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. diff --git a/docs/Makefile.am b/docs/Makefile.am index c428e069db..3a2954be5f 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -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 "$(`_ 1.35 or newer * `OpenSSL `_ -To build from git, the following dependencies are also required: +To build from a Git repository clone, the following dependencies are also required: * `ragel `_ * `bison `_ * `flex `_ -* `virtualenv `_ +* `Python `_ 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 index 0000000000..f0f873d199 --- /dev/null +++ b/m4/ax_python_module.m4 @@ -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 index 0000000000..41830b2030 --- /dev/null +++ b/m4/pdns_check_python_venv.m4 @@ -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 index 873cde5df0..0000000000 --- a/m4/pdns_check_virtualenv.m4 +++ /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"]) -]) diff --git a/pdns/Makefile.am b/pdns/Makefile.am index d85f1d7050..668c1fd90a 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -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 index 0000000000..ca33e9f30d --- /dev/null +++ b/pdns/convert-yaml-to-json.py @@ -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=(',', ': ')) diff --git a/pdns/dnsdistdist/Makefile.am b/pdns/dnsdistdist/Makefile.am index 1bea3b3330..39af1b0a98 100644 --- a/pdns/dnsdistdist/Makefile.am +++ b/pdns/dnsdistdist/Makefile.am @@ -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 diff --git a/pdns/dnsdistdist/configure.ac b/pdns/dnsdistdist/configure.ac index b09a7e02b1..62850326e8 100644 --- a/pdns/dnsdistdist/configure.ac +++ b/pdns/dnsdistdist/configure.ac @@ -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" diff --git a/pdns/dnsdistdist/docs/Makefile.sphinx b/pdns/dnsdistdist/docs/Makefile.sphinx index 4c16b320f3..fc4234cf7b 100644 --- a/pdns/dnsdistdist/docs/Makefile.sphinx +++ b/pdns/dnsdistdist/docs/Makefile.sphinx @@ -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 index 0000000000..2e5cecaca2 --- /dev/null +++ b/pdns/dnsdistdist/m4/ax_python_module.m4 @@ -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 index 0000000000..35efa28695 --- /dev/null +++ b/pdns/dnsdistdist/m4/pdns_check_python_venv.m4 @@ -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 index 214d4505df..0000000000 --- a/pdns/dnsdistdist/m4/pdns_check_virtualenv.m4 +++ /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"]) -]) - diff --git a/pdns/recursordist/Makefile.am b/pdns/recursordist/Makefile.am index 898635add7..6e5a0e8e54 100644 --- a/pdns/recursordist/Makefile.am +++ b/pdns/recursordist/Makefile.am @@ -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 diff --git a/pdns/recursordist/configure.ac b/pdns/recursordist/configure.ac index d5de20b845..f5f525ad5e 100644 --- a/pdns/recursordist/configure.ac +++ b/pdns/recursordist/configure.ac @@ -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) diff --git a/pdns/recursordist/docs/Makefile.sphinx b/pdns/recursordist/docs/Makefile.sphinx index 7e5c1f3e9a..c093fd2ef0 100644 --- a/pdns/recursordist/docs/Makefile.sphinx +++ b/pdns/recursordist/docs/Makefile.sphinx @@ -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 index 0000000000..2e5cecaca2 --- /dev/null +++ b/pdns/recursordist/m4/ax_python_module.m4 @@ -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 index 0000000000..35efa28695 --- /dev/null +++ b/pdns/recursordist/m4/pdns_check_python_venv.m4 @@ -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 index 8f735b2193..0000000000 --- a/pdns/recursordist/m4/pdns_check_virtualenv.m4 +++ /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"]) -]) - diff --git a/regression-tests.api/runtests b/regression-tests.api/runtests index 56e5bf77b3..9ef71c5cd7 100755 --- a/regression-tests.api/runtests +++ b/regression-tests.api/runtests @@ -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 diff --git a/regression-tests.auth-py/runtests b/regression-tests.auth-py/runtests index 6c30ba8c66..5a251623c3 100755 --- a/regression-tests.auth-py/runtests +++ b/regression-tests.auth-py/runtests @@ -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 diff --git a/regression-tests.dnsdist/runtests b/regression-tests.dnsdist/runtests index 93543922c5..a860fd782c 100755 --- a/regression-tests.dnsdist/runtests +++ b/regression-tests.dnsdist/runtests @@ -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 diff --git a/regression-tests.ixfrdist/runtests b/regression-tests.ixfrdist/runtests index 0bbf43915d..efcc4e250c 100755 --- a/regression-tests.ixfrdist/runtests +++ b/regression-tests.ixfrdist/runtests @@ -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 diff --git a/regression-tests.recursor-dnssec/runtests b/regression-tests.recursor-dnssec/runtests index b21a776e66..08b0e5efad 100755 --- a/regression-tests.recursor-dnssec/runtests +++ b/regression-tests.recursor-dnssec/runtests @@ -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 -- 2.39.5