diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fbeaddb..648d07db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,14 +196,19 @@ if (WANT_PYTHON) message(FATAL_ERROR "Invalid value of WANT_PYTHON_VERSION") endif() endif() - # Compatibility with pkg-config variables - set(Python3_LDFLAGS "${Python3_LIBRARIES}") + if (Python3_FOUND AND Python3_VERSION VERSION_LESS 3.3) + message(STATUS "Python too old, need at least 3.3") + set(Python3_FOUND OFF) + else() + # Compatibility with pkg-config variables + set(Python3_LDFLAGS "${Python3_LIBRARIES}") + endif() endif() if (NOT Python3_FOUND AND WANT_PYTHON_VERSION MATCHES "^python") # Since python 3.8, -embed is required for embedding. - pkg_check_modules(Python3 "${WANT_PYTHON_VERSION}-embed >= 3.0") + pkg_check_modules(Python3 "${WANT_PYTHON_VERSION}-embed >= 3.3") if (NOT Python3_FOUND) - pkg_check_modules(Python3 "${WANT_PYTHON_VERSION} >= 3.0") + pkg_check_modules(Python3 "${WANT_PYTHON_VERSION} >= 3.3") endif() endif() if (NOT Python3_FOUND) diff --git a/README.md b/README.md index 6ab52284..82f3f3b9 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ modperl: * SWIG if building from git modpython: -* python3 and its bundled libpython +* python 3.3+ and its bundled libpython * perl is a build dependency * macOS: Python from Homebrew is preferred over system version * SWIG if building from git diff --git a/configure.ac b/configure.ac index 3298f04e..2dd5b1d3 100644 --- a/configure.ac +++ b/configure.ac @@ -570,8 +570,8 @@ if test "x$PYTHON" != "xno"; then if test -z "$PKG_CONFIG"; then AC_MSG_ERROR([pkg-config is required for modpython.]) fi - PKG_CHECK_MODULES([python], [$PYTHON-embed >= 3.0],, [ - PKG_CHECK_MODULES([python], [$PYTHON >= 3.0],, AC_MSG_ERROR([$PYTHON.pc not found or is wrong. Try --disable-python or install python3.])) + PKG_CHECK_MODULES([python], [$PYTHON-embed >= 3.3],, [ + PKG_CHECK_MODULES([python], [$PYTHON >= 3.3],, AC_MSG_ERROR([$PYTHON.pc not found or is wrong. Try --disable-python or install python3.])) ]) my_saved_LIBS="$LIBS" my_saved_CXXFLAGS="$CXXFLAGS" diff --git a/modules/modpython/znc.py b/modules/modpython/znc.py index e664367f..478c5a39 100644 --- a/modules/modpython/znc.py +++ b/modules/modpython/znc.py @@ -25,7 +25,7 @@ from functools import wraps import imp import re import traceback -import collections +import collections.abc from znc_core import * @@ -125,7 +125,7 @@ class Timer: pass -class ModuleNVIter(collections.Iterator): +class ModuleNVIter(collections.abc.Iterator): def __init__(self, cmod): self._cmod = cmod self.it = cmod.BeginNV_() @@ -138,7 +138,7 @@ class ModuleNVIter(collections.Iterator): return res -class ModuleNV(collections.MutableMapping): +class ModuleNV(collections.abc.MutableMapping): def __init__(self, cmod): self._cmod = cmod @@ -957,7 +957,7 @@ CModule.AddSocket = FreeOwnership(func=CModule.AddSocket) CModule.AddSubPage = FreeOwnership(func=CModule.AddSubPage) -class ModulesIter(collections.Iterator): +class ModulesIter(collections.abc.Iterator): def __init__(self, cmod): self._cmod = cmod