Skip to content

Commit 04b2a6f

Browse files
authored
use Python version provided by platform in CI / prefer python3 (#3776)
1 parent 8a455c2 commit 04b2a6f

5 files changed

Lines changed: 25 additions & 19 deletions

File tree

.github/workflows/CI-unixish.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v2
1919

20-
- name: Set up Python 3.10
21-
uses: actions/setup-python@v2
22-
with:
23-
python-version: '3.10'
24-
2520
- name: Install missing software on ubuntu
2621
if: contains(matrix.os, 'ubuntu')
2722
run: |
@@ -38,12 +33,12 @@ jobs:
3833
- name: Install missing software on macos
3934
if: contains(matrix.os, 'macos')
4035
run: |
41-
brew install coreutils z3 qt@5
36+
brew install coreutils python3 z3 qt@5
4237
4338
- name: Install missing Python packages
4439
run: |
45-
python -m pip install pip --upgrade
46-
python -m pip install pytest
40+
python3 -m pip install pip --upgrade
41+
python3 -m pip install pytest
4742
4843
- name: CMake build on ubuntu (with GUI / system tinyxml2)
4944
if: contains(matrix.os, 'ubuntu')
@@ -119,11 +114,11 @@ jobs:
119114
- name: Run test/cli
120115
run: |
121116
cd test/cli
122-
pytest test-*.py
117+
python3 -m pytest test-*.py
123118
cd ../../..
124119
ln -s cppcheck 'cpp check'
125120
cd 'cpp check/test/cli'
126-
pytest test-*.py
121+
python3 -m pytest test-*.py
127122
128123
# fails on macos since some includes (e.g. sys/epoll.h) are not available
129124
- name: Run cfg tests

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ ifeq ($(SRCDIR),build)
2020
endif
2121
ifeq ($(MATCHCOMPILER),yes)
2222
# Find available Python interpreter
23-
PYTHON_INTERPRETER := $(shell which python)
23+
PYTHON_INTERPRETER := $(shell which python3)
2424
ifndef PYTHON_INTERPRETER
25-
PYTHON_INTERPRETER := $(shell which python3)
25+
PYTHON_INTERPRETER := $(shell which python)
2626
endif
2727
ifndef PYTHON_INTERPRETER
2828
$(error Did not find a Python interpreter)

cmake/findDependencies.cmake

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ endif()
3434
set(CMAKE_INCLUDE_CURRENT_DIR ON)
3535

3636
if (NOT USE_MATCHCOMPILER_OPT MATCHES "Off")
37-
find_package(PythonInterp)
38-
if (NOT ${PYTHONINTERP_FOUND})
39-
message(WARNING "No python interpreter found. Therefore, the match compiler is switched off.")
40-
set(USE_MATCHCOMPILER_OPT "Off")
37+
find_package(PythonInterp 3 QUIET)
38+
if (NOT PYTHONINTERP_FOUND)
39+
set(PYTHONINTERP_FOUND "")
40+
find_package(PythonInterp 2.7 QUIET)
41+
if (NOT PYTHONINTERP_FOUND)
42+
message(WARNING "No python interpreter found. Therefore, the match compiler is switched off.")
43+
set(USE_MATCHCOMPILER_OPT "Off")
44+
endif()
4145
endif()
4246
endif()
4347

@@ -48,7 +52,6 @@ if (NOT USE_BUNDLED_TINYXML2)
4852
if (NOT tinyxml2_LIBRARY)
4953
message(FATAL_ERROR "tinyxml2 has not been found")
5054
else()
51-
message(STATUS "tinyxml2_LIBRARY: ${tinyxml2_LIBRARY}")
5255
set(tinyxml2_FOUND 1)
5356
endif()
5457
endif()

cmake/printInfo.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,20 @@ if (HAVE_RULES)
4747
message( STATUS "PCRE_LIBRARY = ${PCRE_LIBRARY}" )
4848
endif()
4949
message( STATUS )
50+
if (NOT USE_MATCHCOMPILER_OPT MATCHES "Off")
51+
message( STATUS "PYTHON_VERSION_STRING = ${PYTHON_VERSION_STRING}" )
52+
message( STATUS "PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}" )
53+
endif()
54+
message( STATUS )
5055
message( STATUS "USE_Z3 = ${USE_Z3}" )
5156
if (USE_Z3)
5257
message( STATUS "Z3_LIBRARIES = ${Z3_LIBRARIES}" )
5358
message( STATUS "Z3_CXX_INCLUDE_DIRS = ${Z3_CXX_INCLUDE_DIRS}" )
5459
endif()
5560
message( STATUS "USE_BUNDLED_TINYXML2 = ${USE_BUNDLED_TINYXML2}" )
61+
if (NOT USE_BUNDLED_TINYXML2)
62+
message(STATUS "tinyxml2_LIBRARY = ${tinyxml2_LIBRARY}")
63+
endif()
5664
message( STATUS )
5765

5866
if(${ANALYZE_ADDRESS})

tools/dmake.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,9 @@ int main(int argc, char **argv)
254254
<< "endif\n";
255255
fout << "ifeq ($(MATCHCOMPILER),yes)\n"
256256
<< " # Find available Python interpreter\n"
257-
<< " PYTHON_INTERPRETER := $(shell which python)\n"
257+
<< " PYTHON_INTERPRETER := $(shell which python3)\n"
258258
<< " ifndef PYTHON_INTERPRETER\n"
259-
<< " PYTHON_INTERPRETER := $(shell which python3)\n"
259+
<< " PYTHON_INTERPRETER := $(shell which python)\n"
260260
<< " endif\n"
261261
<< " ifndef PYTHON_INTERPRETER\n"
262262
<< " $(error Did not find a Python interpreter)\n"

0 commit comments

Comments
 (0)