From 8e7fe9e415a3e71b9c9de75f651f3f2e556abcab Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 11 Feb 2022 16:29:09 +0100 Subject: [PATCH 1/4] prefer python3 for matchcompiler in build --- Makefile | 4 ++-- cmake/findDependencies.cmake | 12 ++++++++---- cmake/printInfo.cmake | 5 +++++ tools/dmake.cpp | 4 ++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index c662bcf44cf..5ec799fc832 100644 --- a/Makefile +++ b/Makefile @@ -20,9 +20,9 @@ ifeq ($(SRCDIR),build) endif ifeq ($(MATCHCOMPILER),yes) # Find available Python interpreter - PYTHON_INTERPRETER := $(shell which python) + PYTHON_INTERPRETER := $(shell which python3) ifndef PYTHON_INTERPRETER - PYTHON_INTERPRETER := $(shell which python3) + PYTHON_INTERPRETER := $(shell which python) endif ifndef PYTHON_INTERPRETER $(error Did not find a Python interpreter) diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake index 31b58a54ed1..5c28138c44c 100644 --- a/cmake/findDependencies.cmake +++ b/cmake/findDependencies.cmake @@ -34,10 +34,14 @@ endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) if (NOT USE_MATCHCOMPILER_OPT MATCHES "Off") - find_package(PythonInterp) - if (NOT ${PYTHONINTERP_FOUND}) - message(WARNING "No python interpreter found. Therefore, the match compiler is switched off.") - set(USE_MATCHCOMPILER_OPT "Off") + find_package(PythonInterp 3 QUIET) + if (NOT PYTHONINTERP_FOUND) + set(PYTHONINTERP_FOUND "") + find_package(PythonInterp 2.7 QUIET) + if (NOT PYTHONINTERP_FOUND) + message(WARNING "No python interpreter found. Therefore, the match compiler is switched off.") + set(USE_MATCHCOMPILER_OPT "Off") + endif() endif() endif() diff --git a/cmake/printInfo.cmake b/cmake/printInfo.cmake index 3fb2495ee71..6be07b967ac 100644 --- a/cmake/printInfo.cmake +++ b/cmake/printInfo.cmake @@ -47,6 +47,11 @@ if (HAVE_RULES) message( STATUS "PCRE_LIBRARY = ${PCRE_LIBRARY}" ) endif() message( STATUS ) +if (NOT USE_MATCHCOMPILER_OPT MATCHES "Off") + message( STATUS "PYTHON_VERSION_STRING = ${PYTHON_VERSION_STRING}" ) + message( STATUS "PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}" ) +endif() +message( STATUS ) message( STATUS "USE_Z3 = ${USE_Z3}" ) if (USE_Z3) message( STATUS "Z3_LIBRARIES = ${Z3_LIBRARIES}" ) diff --git a/tools/dmake.cpp b/tools/dmake.cpp index b1712a8ee59..50580b5944a 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -254,9 +254,9 @@ int main(int argc, char **argv) << "endif\n"; fout << "ifeq ($(MATCHCOMPILER),yes)\n" << " # Find available Python interpreter\n" - << " PYTHON_INTERPRETER := $(shell which python)\n" + << " PYTHON_INTERPRETER := $(shell which python3)\n" << " ifndef PYTHON_INTERPRETER\n" - << " PYTHON_INTERPRETER := $(shell which python3)\n" + << " PYTHON_INTERPRETER := $(shell which python)\n" << " endif\n" << " ifndef PYTHON_INTERPRETER\n" << " $(error Did not find a Python interpreter)\n" From 43c2b0eee9afa53855d58541537347ae43c5d463 Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 11 Feb 2022 16:29:25 +0100 Subject: [PATCH 2/4] adjusted some CMake logging --- cmake/findDependencies.cmake | 1 - cmake/printInfo.cmake | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake index 5c28138c44c..67ddae1221f 100644 --- a/cmake/findDependencies.cmake +++ b/cmake/findDependencies.cmake @@ -52,7 +52,6 @@ if (NOT USE_BUNDLED_TINYXML2) if (NOT tinyxml2_LIBRARY) message(FATAL_ERROR "tinyxml2 has not been found") else() - message(STATUS "tinyxml2_LIBRARY: ${tinyxml2_LIBRARY}") set(tinyxml2_FOUND 1) endif() endif() diff --git a/cmake/printInfo.cmake b/cmake/printInfo.cmake index 6be07b967ac..a81976c3d79 100644 --- a/cmake/printInfo.cmake +++ b/cmake/printInfo.cmake @@ -58,6 +58,9 @@ if (USE_Z3) message( STATUS "Z3_CXX_INCLUDE_DIRS = ${Z3_CXX_INCLUDE_DIRS}" ) endif() message( STATUS "USE_BUNDLED_TINYXML2 = ${USE_BUNDLED_TINYXML2}" ) +if (NOT USE_BUNDLED_TINYXML2) + message(STATUS "tinyxml2_LIBRARY = ${tinyxml2_LIBRARY}") +endif() message( STATUS ) if(${ANALYZE_ADDRESS}) From 2604954c0ea302486501dcb5538cb8758f0fc9ab Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 11 Feb 2022 16:29:58 +0100 Subject: [PATCH 3/4] CI-unixish.yml: use python3 --- .github/workflows/CI-unixish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index f41a7d1aa09..790239600de 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -42,8 +42,8 @@ jobs: - name: Install missing Python packages run: | - python -m pip install pip --upgrade - python -m pip install pytest + python3 -m pip install pip --upgrade + python3 -m pip install pytest - name: CMake build on ubuntu (with GUI / system tinyxml2) if: contains(matrix.os, 'ubuntu') @@ -119,11 +119,11 @@ jobs: - name: Run test/cli run: | cd test/cli - pytest test-*.py + python3 -m pytest test-*.py cd ../../.. ln -s cppcheck 'cpp check' cd 'cpp check/test/cli' - pytest test-*.py + python3 -m pytest test-*.py # fails on macos since some includes (e.g. sys/epoll.h) are not available - name: Run cfg tests From f496ddca7b5e0fc87f87fd7366e1f05d17c3485b Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 11 Feb 2022 16:30:16 +0100 Subject: [PATCH 4/4] CI-unixish.yml: use Python version provided by platform --- .github/workflows/CI-unixish.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/CI-unixish.yml b/.github/workflows/CI-unixish.yml index 790239600de..ba2429e4c0f 100644 --- a/.github/workflows/CI-unixish.yml +++ b/.github/workflows/CI-unixish.yml @@ -17,11 +17,6 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Python 3.10 - uses: actions/setup-python@v2 - with: - python-version: '3.10' - - name: Install missing software on ubuntu if: contains(matrix.os, 'ubuntu') run: | @@ -38,7 +33,7 @@ jobs: - name: Install missing software on macos if: contains(matrix.os, 'macos') run: | - brew install coreutils z3 qt@5 + brew install coreutils python3 z3 qt@5 - name: Install missing Python packages run: |