Skip to content

Commit

Permalink
python: Add python 3.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Oct 5, 2023
1 parent 05b72ea commit 6602027
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/amd64_linux_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']
fail-fast: false
env:
CC: gcc-12
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/amd64_macos_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']
fail-fast: false
steps:
- name: Check out repository code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/amd64_macos_cmake_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Check swig
run: swig -version
- name: Update Path
run: echo "$HOME/Library/Python/3.11/bin" >> $GITHUB_PATH
run: echo "$HOME/Library/Python/3.12/bin" >> $GITHUB_PATH
- name: Check cmake
run: cmake --version
- name: Configure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/amd64_windows_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
runner: [windows-2022, windows-2019]
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']
fail-fast: false # Don't cancel all jobs if one fails.
runs-on: ${{ matrix.runner }}
#runs-on: windows-latest
Expand Down
1 change: 1 addition & 0 deletions ortools/python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ setup(
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: C++',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Office/Business :: Scheduling',
Expand Down
4 changes: 2 additions & 2 deletions tools/release/build_delivery_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,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 3.11)
local -r PY=(3.8 3.9 3.10 3.11 3.12)
else
local -r PY=(3.8 3.9 3.10 3.11)
local -r PY=(3.8 3.9 3.10 3.11 3.12)
fi

for PY_VERSION in "${PY[@]}"; do
Expand Down
4 changes: 2 additions & 2 deletions tools/release/build_delivery_win.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ echo Python build seems up to date, skipping
exit /B 0
)

for %%v in (8 9 10 11) do (
for %%v in (8 9 10 11 12) do (
title Build Python 3.%%v
:: Check Python
which.exe C:\python3%%v-64\python.exe || exit 1
Expand Down Expand Up @@ -312,7 +312,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 (8 9 10 11) do (
for %%v in (8 9 10 11 12) do (
del /s /f /q temp_python3%%v
rmdir /s /q temp_python3%%v
)
Expand Down
4 changes: 2 additions & 2 deletions tools/release/test_delivery_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ command -v make | xargs echo "make: " | tee -a test.log
command -v swig | xargs echo "swig: " | tee -a test.log
# python
if [[ ${PLATFORM} == "arm64" ]]; then
local -r PY=(3.8 3.9 3.10 3.11)
local -r PY=(3.8 3.9 3.10 3.11 3.12)
else
local -r PY=(3.8 3.9 3.10 3.11)
local -r PY=(3.8 3.9 3.10 3.11 3.12)
fi

for i in "${PY[@]}"; do
Expand Down
33 changes: 33 additions & 0 deletions tools/release/test_delivery_win.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,36 @@ echo Testing ortools Python3.11... | 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 .

REM ###################
REM ## PYTHON 3.12 ##
REM ###################
echo Cleaning Python... | tee.exe -a test.log
make.exe clean_python WINDOWS_PATH_TO_PYTHON=c:\python312-64
echo Cleaning Python...DONE | tee.exe -a test.log

REM make.exe python WINDOWS_PATH_TO_PYTHON=c:\python312-64 || exit 1
REM echo make python3.12: DONE | tee.exe -a build.log
REM make.exe test_python WINDOWS_PATH_TO_PYTHON=c:\python312-64 || exit 1
REM echo make test_python3.12: DONE | tee.exe -a build.log
echo Rebuild Python3.12 pypi archive... | tee.exe -a test.log
make.exe package_python WINDOWS_PATH_TO_PYTHON=c:\python312-64 || exit 1
echo Rebuild Python3.12 pypi archive...DONE | tee.exe -a test.log

echo Creating Python3.12 venv... | tee.exe -a test.log
set PATH=c:\python312-64;c:\python312-64\Scripts;%PATH%
python -m pip install virtualenv
set TEMP_DIR=temp_python312
python -m virtualenv %TEMP_DIR%\venv
set PATH=%LOCAL_PATH%
echo Creating Python3.12 venv...DONE | tee.exe -a test.log

echo Installing ortools Python3.12 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.12 venv...DONE | tee.exe -a test.log

echo Testing ortools Python3.12... | 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.12...DONE | tee.exe -a test.log

FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .

0 comments on commit 6602027

Please sign in to comment.