diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake index 3675bd5167c..bdfc171d7e9 100644 --- a/cmake/findDependencies.cmake +++ b/cmake/findDependencies.cmake @@ -42,22 +42,8 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) if(CMAKE_VERSION VERSION_EQUAL "3.12" OR CMAKE_VERSION VERSION_GREATER "3.12") find_package(Python COMPONENTS Interpreter) - if(NOT Python_Interpreter_FOUND) - message(WARNING "No python interpreter found - disabling matchcompiler.") - set(USE_MATCHCOMPILER_OPT "Off") - endif() else() find_package(PythonInterp 3 QUIET) - if(NOT PYTHONINTERP_FOUND) - set(PYTHONINTERP_FOUND "") - find_package(PythonInterp 2.7 QUIET) - if(NOT PYTHONINTERP_FOUND AND NOT USE_MATCHCOMPILER_OPT STREQUAL "Off") - message(WARNING "No python interpreter found - disabling matchcompiler.") - set(USE_MATCHCOMPILER_OPT "Off") - else() - message(WARNING "Support for Python 2.7 is deprecated (it went EOL in January 2020) and will be removed in Cppcheck 2.16 - please use Python 3.x instead.") - endif() - endif() if(PYTHONINTERP_FOUND) set(Python_EXECUTABLE ${PYTHON_EXECUTABLE}) set(Python_VERSION ${PYTHON_VERSION_STRING}) @@ -65,6 +51,11 @@ else() endif() endif() +if(NOT Python_Interpreter_FOUND AND NOT USE_MATCHCOMPILER_OPT STREQUAL "Off") + message(WARNING "No python interpreter found - disabling matchcompiler.") + set(USE_MATCHCOMPILER_OPT "Off") +endif() + if(NOT USE_BUNDLED_TINYXML2) find_package(tinyxml2 QUIET) if(TARGET tinyxml2::tinyxml2) diff --git a/htmlreport/README.txt b/htmlreport/README.txt index 88a84a1637f..38c035e27f2 100644 --- a/htmlreport/README.txt +++ b/htmlreport/README.txt @@ -3,7 +3,7 @@ cppcheck-htmlreport This is a little utility to generate a html report of a XML file produced by cppcheck. -The utility is implemented in Python (2.7+) and requires the pygments module +The utility is implemented in Python and requires the pygments module to generate syntax highlighted source code. If you are using a Debian based Linux system, the pygments package can be installed by following command: diff --git a/releasenotes.txt b/releasenotes.txt index 5afee3d96af..94dd2493697 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -13,6 +13,7 @@ Changed interface: - Deprecations: +- The previously deprecated support for Python 2.7 has been removed. please use Python 3 instead. - Other: diff --git a/test/tools/htmlreport/test_htmlreport.py b/test/tools/htmlreport/test_htmlreport.py index 4b40650cf09..31ac670110d 100755 --- a/test/tools/htmlreport/test_htmlreport.py +++ b/test/tools/htmlreport/test_htmlreport.py @@ -8,11 +8,7 @@ import sys import tempfile -if sys.version_info < (2, 7): - # For TestCase.assertIn(). - import unittest2 as unittest -else: - import unittest +import unittest TEST_TOOLS_DIR = os.path.abspath(os.path.dirname(__file__)) ROOT_DIR = os.path.split(os.path.dirname(os.path.dirname(TEST_TOOLS_DIR)))[0] diff --git a/tools/reduce.py b/tools/reduce.py index 595aaff18c8..64ab18f7ab2 100755 --- a/tools/reduce.py +++ b/tools/reduce.py @@ -38,17 +38,10 @@ def print_info(self): print('FILE=' + self.__file) def __communicate(self, p, timeout=None, **kwargs): - if sys.version_info[0] < 3: - return p.communicate(**kwargs) - else: - return p.communicate(timeout=timeout) + return p.communicate(timeout=timeout) def runtool(self, filedata=None): - if sys.version_info[0] < 3: - class TimeoutExpired(Exception): - pass - else: - TimeoutExpired = subprocess.TimeoutExpired + TimeoutExpired = subprocess.TimeoutExpired timeout = None if self.__elapsed_time: