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: steps:
- uses: actions/checkout@v2 - 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 - name: Install missing software on ubuntu
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | run: |
@ -38,12 +33,12 @@ jobs:
- name: Install missing software on macos - name: Install missing software on macos
if: contains(matrix.os, 'macos') if: contains(matrix.os, 'macos')
run: | run: |
brew install coreutils z3 qt@5 brew install coreutils python3 z3 qt@5
- name: Install missing Python packages - name: Install missing Python packages
run: | run: |
python -m pip install pip --upgrade python3 -m pip install pip --upgrade
python -m pip install pytest python3 -m pip install pytest
- name: CMake build on ubuntu (with GUI / system tinyxml2) - name: CMake build on ubuntu (with GUI / system tinyxml2)
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
@ -119,11 +114,11 @@ jobs:
- name: Run test/cli - name: Run test/cli
run: | run: |
cd test/cli cd test/cli
pytest test-*.py python3 -m pytest test-*.py
cd ../../.. cd ../../..
ln -s cppcheck 'cpp check' ln -s cppcheck 'cpp check'
cd 'cpp check/test/cli' 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 # fails on macos since some includes (e.g. sys/epoll.h) are not available
- name: Run cfg tests - name: Run cfg tests

View File

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

View File

@ -34,10 +34,14 @@ endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
if (NOT USE_MATCHCOMPILER_OPT MATCHES "Off") if (NOT USE_MATCHCOMPILER_OPT MATCHES "Off")
find_package(PythonInterp) find_package(PythonInterp 3 QUIET)
if (NOT ${PYTHONINTERP_FOUND}) if (NOT PYTHONINTERP_FOUND)
message(WARNING "No python interpreter found. Therefore, the match compiler is switched off.") set(PYTHONINTERP_FOUND "")
set(USE_MATCHCOMPILER_OPT "Off") 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()
endif() endif()
@ -48,7 +52,6 @@ if (NOT USE_BUNDLED_TINYXML2)
if (NOT tinyxml2_LIBRARY) if (NOT tinyxml2_LIBRARY)
message(FATAL_ERROR "tinyxml2 has not been found") message(FATAL_ERROR "tinyxml2 has not been found")
else() else()
message(STATUS "tinyxml2_LIBRARY: ${tinyxml2_LIBRARY}")
set(tinyxml2_FOUND 1) set(tinyxml2_FOUND 1)
endif() endif()
endif() endif()

View File

@ -47,12 +47,20 @@ if (HAVE_RULES)
message( STATUS "PCRE_LIBRARY = ${PCRE_LIBRARY}" ) message( STATUS "PCRE_LIBRARY = ${PCRE_LIBRARY}" )
endif() endif()
message( STATUS ) 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}" ) message( STATUS "USE_Z3 = ${USE_Z3}" )
if (USE_Z3) if (USE_Z3)
message( STATUS "Z3_LIBRARIES = ${Z3_LIBRARIES}" ) message( STATUS "Z3_LIBRARIES = ${Z3_LIBRARIES}" )
message( STATUS "Z3_CXX_INCLUDE_DIRS = ${Z3_CXX_INCLUDE_DIRS}" ) message( STATUS "Z3_CXX_INCLUDE_DIRS = ${Z3_CXX_INCLUDE_DIRS}" )
endif() endif()
message( STATUS "USE_BUNDLED_TINYXML2 = ${USE_BUNDLED_TINYXML2}" ) message( STATUS "USE_BUNDLED_TINYXML2 = ${USE_BUNDLED_TINYXML2}" )
if (NOT USE_BUNDLED_TINYXML2)
message(STATUS "tinyxml2_LIBRARY = ${tinyxml2_LIBRARY}")
endif()
message( STATUS ) message( STATUS )
if(${ANALYZE_ADDRESS}) if(${ANALYZE_ADDRESS})

View File

@ -254,9 +254,9 @@ int main(int argc, char **argv)
<< "endif\n"; << "endif\n";
fout << "ifeq ($(MATCHCOMPILER),yes)\n" fout << "ifeq ($(MATCHCOMPILER),yes)\n"
<< " # Find available Python interpreter\n" << " # Find available Python interpreter\n"
<< " PYTHON_INTERPRETER := $(shell which python)\n" << " PYTHON_INTERPRETER := $(shell which python3)\n"
<< " ifndef PYTHON_INTERPRETER\n" << " ifndef PYTHON_INTERPRETER\n"
<< " PYTHON_INTERPRETER := $(shell which python3)\n" << " PYTHON_INTERPRETER := $(shell which python)\n"
<< " endif\n" << " endif\n"
<< " ifndef PYTHON_INTERPRETER\n" << " ifndef PYTHON_INTERPRETER\n"
<< " $(error Did not find a Python interpreter)\n" << " $(error Did not find a Python interpreter)\n"