diff --git a/configure.ac b/configure.ac index 55289f6..990115b 100644 --- a/configure.ac +++ b/configure.ac @@ -41,35 +41,33 @@ AC_ARG_WITH([rst2man], AS_HELP_STRING([--with-rst2man=PATH], [Location of rst2man (auto)]), [RST2MAN="$withval"], AC_CHECK_PROGS(RST2MAN, - [rst2man-3.6 rst2man-3 rst2man rst2man.py], + [rst2man rst2man.py rst2man-3.6 rst2man-2.7], [no])) if test "x$RST2MAN" = "xno"; then AC_MSG_ERROR( - [rst2man is needed to build Varnish, please install python3-docutils.]) + [rst2man is needed to build Varnish, please install python-docutils.]) fi AC_ARG_WITH([sphinx-build], AS_HELP_STRING([--with-sphinx-build=PATH], [Location of sphinx-build (auto)]), [SPHINX="$withval"], AC_CHECK_PROGS(SPHINX, - [sphinx-build-3.6 sphinx-build-3 sphinx-build], + [sphinx-build sphinx-build-3.6 sphinx-build-2.7], [no])) if test "x$SPHINX" = "xno"; then AC_MSG_ERROR( - [sphinx-build is needed to build Varnish, please install python3-sphinx.]) + [sphinx-build is needed to build Varnish, please install python-sphinx.]) fi AC_ARG_WITH([rst2html], - AS_HELP_STRING([--with-rst2html=PATH], [Location of rst2html (auto)]), - [RST2HTML="$withval"], - AC_CHECK_PROGS(RST2HTML, - [rst2html-3.6 rst2html-3 rst2html rst2html.py], - "no")) + AS_HELP_STRING([--with-rst2html=PATH], + [Location of rst2html (auto)]), + [RST2HTML="$withval"], + [AC_CHECK_PROGS(RST2HTML, [rst2html rst2html.py], "no") + if test "x$RST2HTML" = "xno"; then + AC_MSG_WARN([rst2html not found - not building changelog]) + fi]) AM_CONDITIONAL(HAVE_RST2HTML,[test "x$RST2HTML" != "xno"]) -if test "x$RST2HTML" = "xno"; then - AC_MSG_ERROR( - [rst2html not found - (Weird, we found rst2man?!)]) -fi AC_ARG_WITH([dot], AS_HELP_STRING([--with-dot=PATH], diff --git a/doc/sphinx/vtc-syntax.py b/doc/sphinx/vtc-syntax.py index 8b15ca7..6d4946d 100644 --- a/doc/sphinx/vtc-syntax.py +++ b/doc/sphinx/vtc-syntax.py @@ -29,6 +29,7 @@ # Process various varnishtest C files and output reStructuredText to be # included in vtc(7). +from __future__ import print_function import sys import re @@ -38,7 +39,7 @@ def parse_file(fn, cl, tl, sl): section = "" resec = re.compile("[ /]\* SECTION: ") - f = open(fn, "r", encoding="UTF-8") + f = open(fn, "r") for l in f: if "*/" in l: diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py index be3dd32..0118d79 100755 --- a/lib/libvcc/generate.py +++ b/lib/libvcc/generate.py @@ -30,6 +30,8 @@ # Generate various .c and .h files for the VCL compiler and the interfaces # for it. +from __future__ import print_function + ####################################################################### # These are our tokens diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 35c19e9..14f93b1 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -33,6 +33,9 @@ Read the vmod.vcc file (inputvcc) and produce: vmod_${name}.rst -- Extracted documentation """ +# This script should work with both Python 2 and Python 3. +from __future__ import print_function + import os import sys import re diff --git a/lib/libvcc/vsctool.py b/lib/libvcc/vsctool.py index d95b66e..e65b007 100644 --- a/lib/libvcc/vsctool.py +++ b/lib/libvcc/vsctool.py @@ -35,6 +35,8 @@ the same general syntax as a `.rst` file, but for now we process it with this program to get a *real* `.rst` file. ''' +from __future__ import print_function + import getopt import json import sys diff --git a/varnish-legacy.m4 b/varnish-legacy.m4 index 9f67359..e5e2821 100644 --- a/varnish-legacy.m4 +++ b/varnish-legacy.m4 @@ -98,10 +98,9 @@ AC_SUBST([VMOD_DIR]) AC_DEFUN([VARNISH_VMODTOOL], [ -AC_CHECK_PROGS(PYTHON, [python3.9 python3.8 python3.7 python3.6 python3.5 dnl - python3.4 python3 python, "no"]) +AC_CHECK_PROGS(PYTHON, [python3 python3.1 python3.2 python2.7 python2.6 python2.5 python2 python], "no") if test "x$PYTHON" = "xno"; then - AC_MSG_ERROR([Python >= 3.4 is needed to build, please install python.]) + AC_MSG_ERROR([Python is needed to build, please install python.]) fi VARNISH_PKG_GET_VAR([VMODTOOL], [vmodtool]) AC_SUBST([VMODTOOL]) diff --git a/varnish.m4 b/varnish.m4 index 392c36c..71df96d 100644 --- a/varnish.m4 +++ b/varnish.m4 @@ -130,10 +130,10 @@ AC_DEFUN([_VARNISH_CHECK_DEVEL], [ # --------------------- AC_DEFUN([_VARNISH_CHECK_PYTHON], [ m4_define_default([_AM_PYTHON_INTERPRETER_LIST], - [python3.9 python3.8 python3.7 python3.6 python3.5 dnl - python3.4 python3 python]) - AM_PATH_PYTHON([3.4], [], [ - AC_MSG_ERROR([Python >= 3.4 is required.]) +[python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python2.7 dnl +python python2 python3]) + AM_PATH_PYTHON([2.7], [], [ + AC_MSG_ERROR([Python >= 2.7 is required.]) ]) ])