use Python version provided by platform in CI / prefer python3 (#3776)

This commit is contained in:
Oliver Stöneberg 2022-02-11 19:37:32 +01:00 committed by GitHub
parent 8a455c2921
commit 04b2a6f1c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 19 deletions

View File

@ -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,12 +33,12 @@ 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: |
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 +114,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

View File

@ -20,9 +20,9 @@ ifeq ($(SRCDIR),build)
endif
ifeq ($(MATCHCOMPILER),yes)
# Find available Python interpreter
PYTHON_INTERPRETER := $(shell which python)
ifndef PYTHON_INTERPRETER
PYTHON_INTERPRETER := $(shell which python3)
ifndef PYTHON_INTERPRETER
PYTHON_INTERPRETER := $(shell which python)
endif
ifndef PYTHON_INTERPRETER
$(error Did not find a Python interpreter)

View File

@ -34,11 +34,15 @@ endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
if (NOT USE_MATCHCOMPILER_OPT MATCHES "Off")
find_package(PythonInterp)
if (NOT ${PYTHONINTERP_FOUND})
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()
if (NOT USE_BUNDLED_TINYXML2)
@ -48,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()

View File

@ -47,12 +47,20 @@ 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}" )
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})

View File

@ -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"
<< " ifndef PYTHON_INTERPRETER\n"
<< " PYTHON_INTERPRETER := $(shell which python3)\n"
<< " ifndef PYTHON_INTERPRETER\n"
<< " PYTHON_INTERPRETER := $(shell which python)\n"
<< " endif\n"
<< " ifndef PYTHON_INTERPRETER\n"
<< " $(error Did not find a Python interpreter)\n"