Add python 3.11 support (#3515)

This commit is contained in:
Mizux Seiha
2022-10-27 16:22:08 +02:00
committed by Corentin Le Molgat
parent 49d3c1ecbf
commit abd7328623
6 changed files with 46 additions and 11 deletions

View File

@@ -100,6 +100,7 @@ setup(
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: C++',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Office/Business :: Scheduling',

View File

@@ -59,6 +59,7 @@ help:
@echo -e "\t\t${BOLD}38${RESET} Python3.8"
@echo -e "\t\t${BOLD}39${RESET} Python3.9"
@echo -e "\t\t${BOLD}310${RESET} Python3.10"
@echo -e "\t\t${BOLD}311${RESET} Python3.11"
@echo
@echo -e "\t${BOLD}<step>${RESET}:"
@echo -e "\t\t${BOLD}env${RESET}"
@@ -200,7 +201,7 @@ cache/python: | cache
-mkdir $@
## MANYLINUX ##
PYTHON_VERSIONS := 36 37 38 39 310
PYTHON_VERSIONS := 36 37 38 39 310 311
export/python/manylinux: | export/python
-mkdir -p $@

View File

@@ -200,9 +200,9 @@ function build_python() {
command -v swig | xargs echo "swig: " | tee -a build.log
if [[ ${PLATFORM} == "arm64" ]]; then
local -r PY=(3.8 3.9 3.10)
local -r PY=(3.8 3.9 3.10 3.11)
else
local -r PY=(3.6 3.7 3.8 3.9 3.10)
local -r PY=(3.6 3.7 3.8 3.9 3.10 3.11)
fi
for i in "${PY[@]}"; do

View File

@@ -260,7 +260,7 @@ echo %BRANCH% %SHA1%>build_examples.log
exit /B 0
REM PYTHON 3.6, 3.7, 3.8, 3.9, 3.10
REM PYTHON 3.6, 3.7, 3.8, 3.9, 3.10, 3.11
:BUILD_PYTHON
title Build Python
set HASH=
@@ -270,7 +270,7 @@ echo Python build seems up to date, skipping
exit /B 0
)
for %%v in (6 7 8 9 10) do (
for %%v in (6 7 8 9 10 11) do (
title Build Python 3.%%v
:: Check Python
which.exe C:\python3%%v-64\python.exe || exit 1
@@ -310,7 +310,7 @@ del /s /f /q temp_dotnet
rmdir /s /q temp_dotnet
del /s /f /q temp_java
rmdir /s /q temp_java
for %%v in (6 7 8 9 10) do (
for %%v in (6 7 8 9 10 11) do (
del /s /f /q temp_python3%%v
rmdir /s /q temp_python3%%v
)

View File

@@ -20,7 +20,7 @@ command -v cmake | xargs echo "cmake: " | tee test.log
command -v make | xargs echo "make: " | tee -a test.log
command -v swig | xargs echo "swig: " | tee -a test.log
# python
PY=(3.6 3.7 3.8 3.9 3.10)
PY=(3.6 3.7 3.8 3.9 3.10 3.11)
for i in "${PY[@]}"; do
command -v "python$i" | xargs echo "python$i: " | tee -a test.log
done
@@ -50,11 +50,11 @@ for i in "${PY[@]}"; do
set +e
echo "Testing ortools Python$i..." | tee -a test.log
(cd "${VENV_DIR}/bin" && ./python -c "from ortools.linear_solver import pywraplp") 2>&1 | tee -a test.log
(cd "${VENV_DIR}/bin" && ./python -c "from ortools.constraint_solver import pywrapcp") 2>&1 | tee -a test.log
(cd "${VENV_DIR}/bin" && ./python -c "from ortools.sat import pywrapsat") 2>&1 | tee -a test.log
(cd "${VENV_DIR}/bin" && ./python -c "from ortools.graph import pywrapgraph") 2>&1 | tee -a test.log
(cd "${VENV_DIR}/bin" && ./python -c "from ortools.algorithms import pywrapknapsack_solver") 2>&1 | tee -a test.log
(cd "${VENV_DIR}/bin" && ./python -c "from ortools.graph import pywrapgraph") 2>&1 | tee -a test.log
(cd "${VENV_DIR}/bin" && ./python -c "from ortools.constraint_solver import pywrapcp") 2>&1 | tee -a test.log
(cd "${VENV_DIR}/bin" && ./python -c "from ortools.linear_solver import pywraplp") 2>&1 | tee -a test.log
(cd "${VENV_DIR}/bin" && ./python -c "from ortools.sat import pywrapsat") 2>&1 | tee -a test.log
"${VENV_DIR}/bin/python" "cmake/samples/python/sample.py" 2>&1 | tee -a test.log
echo "Testing ortools Python$i...DONE" | tee -a test.log
set -e

View File

@@ -188,3 +188,36 @@ echo Testing ortools Python3.10... | tee.exe -a test.log
echo Testing ortools Python3.10...DONE | tee.exe -a test.log
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .
REM ###################
REM ## PYTHON 3.11 ##
REM ###################
echo Cleaning Python... | tee.exe -a test.log
make.exe clean_python WINDOWS_PATH_TO_PYTHON=c:\python311-64
echo Cleaning Python...DONE | tee.exe -a test.log
REM make.exe python WINDOWS_PATH_TO_PYTHON=c:\python311-64 || exit 1
REM echo make python3.11: DONE | tee.exe -a build.log
REM make.exe test_python WINDOWS_PATH_TO_PYTHON=c:\python311-64 || exit 1
REM echo make test_python3.11: DONE | tee.exe -a build.log
echo Rebuild Python3.11 pypi archive... | tee.exe -a test.log
make.exe package_python WINDOWS_PATH_TO_PYTHON=c:\python311-64 || exit 1
echo Rebuild Python3.11 pypi archive...DONE | tee.exe -a test.log
echo Creating Python3.11 venv... | tee.exe -a test.log
set PATH=c:\python311-64;c:\python311-64\Scripts;%PATH%
python -m pip install virtualenv
set TEMP_DIR=temp_python311
python -m virtualenv %TEMP_DIR%\venv
set PATH=%LOCAL_PATH%
echo Creating Python3.11 venv...DONE | tee.exe -a test.log
echo Installing ortools Python3.11 venv... | tee.exe -a test.log
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO %TEMP_DIR%\venv\Scripts\python -m pip install %%i
echo Installing ortools Python3.11 venv...DONE | tee.exe -a test.log
echo Testing ortools Python3.11... | tee.exe -a test.log
%TEMP_DIR%\venv\Scripts\python cmake\samples\python\sample.py 2>&1 | tee.exe -a test.log
echo Testing ortools Python3.11...DONE | tee.exe -a test.log
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .