From 4c9872d5204b660794e3e85b149147345a92c284 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Tue, 7 Jan 2025 10:23:43 +0100 Subject: [PATCH] Parameterize Python version --- ...hon-free-threaded-wheel-windows-test-vs2019.dockerfile | 8 ++++---- .../python-free-threaded-wheel-windows-vs2019.dockerfile | 8 ++++---- ci/docker/python-wheel-windows-test-vs2019.dockerfile | 2 -- ci/docker/python-wheel-windows-vs2019.dockerfile | 2 -- docker-compose.yml | 7 ++++--- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/ci/docker/python-free-threaded-wheel-windows-test-vs2019.dockerfile b/ci/docker/python-free-threaded-wheel-windows-test-vs2019.dockerfile index 875101fe6e54a..dd19443409b23 100644 --- a/ci/docker/python-free-threaded-wheel-windows-test-vs2019.dockerfile +++ b/ci/docker/python-free-threaded-wheel-windows-test-vs2019.dockerfile @@ -18,18 +18,18 @@ # NOTE: You must update PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION in .env # when you update this file. -# based on mcr.microsoft.com/windows/servercore:ltsc2019 -# contains choco and vs2019 preinstalled ARG base FROM ${base} +ARG python=3.13 + SHELL ["powershell", "-NoProfile", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN $filename = 'python-3.13.1-amd64.exe'; \ $url = 'https://www.python.org/ftp/python/3.13.1/' + $filename; \ Invoke-WebRequest -Uri $url -OutFile $filename; \ Start-Process -FilePath $filename -ArgumentList '/quiet', 'Include_freethreaded=1' -Wait -ENV PYTHON_CMD="py -3.13t" +ENV PYTHON_CMD="py -${python}t" SHELL ["cmd", "/S", "/C"] RUN %PYTHON_CMD% -m pip install -U pip setuptools @@ -44,5 +44,5 @@ RUN %PYTHON_CMD% -m pip install \ # cffi-based tests would crash when importing cffi. RUN %PYTHON_CMD% -m pip uninstall -y cffi -ENV PYTHON="3.13t" +ENV PYTHON="${python}t" ENV PYTHON_GIL=0 diff --git a/ci/docker/python-free-threaded-wheel-windows-vs2019.dockerfile b/ci/docker/python-free-threaded-wheel-windows-vs2019.dockerfile index f6f7653f3b1e1..9de2959d64e98 100644 --- a/ci/docker/python-free-threaded-wheel-windows-vs2019.dockerfile +++ b/ci/docker/python-free-threaded-wheel-windows-vs2019.dockerfile @@ -18,18 +18,18 @@ # NOTE: You must update PYTHON_WHEEL_WINDOWS_IMAGE_REVISION in .env # when you update this file. -# based on mcr.microsoft.com/windows/servercore:ltsc2019 -# contains choco and vs2019 preinstalled ARG base FROM ${base} +ARG python=3.13 + SHELL ["powershell", "-NoProfile", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN $filename = 'python-3.13.1-amd64.exe'; \ $url = 'https://www.python.org/ftp/python/3.13.1/' + $filename; \ Invoke-WebRequest -Uri $url -OutFile $filename; \ Start-Process -FilePath $filename -ArgumentList '/quiet', 'Include_freethreaded=1' -Wait -ENV PYTHON_CMD="py -3.13t" +ENV PYTHON_CMD="py -${python}t" SHELL ["cmd", "/S", "/C"] RUN %PYTHON_CMD% -m pip install -U pip setuptools @@ -43,4 +43,4 @@ RUN %PYTHON_CMD% -m pip install \ cython RUN %PYTHON_CMD% -m pip install -r C:/arrow/python/requirements-wheel-build.txt -ENV PYTHON="3.13t" +ENV PYTHON="${python}t" diff --git a/ci/docker/python-wheel-windows-test-vs2019.dockerfile b/ci/docker/python-wheel-windows-test-vs2019.dockerfile index 91718b07d42f6..3406dfd5e19f7 100644 --- a/ci/docker/python-wheel-windows-test-vs2019.dockerfile +++ b/ci/docker/python-wheel-windows-test-vs2019.dockerfile @@ -18,8 +18,6 @@ # NOTE: You must update PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION in .env # when you update this file. -# based on mcr.microsoft.com/windows/servercore:ltsc2019 -# contains choco and vs2019 preinstalled ARG base # hadolint ignore=DL3006 FROM ${base} diff --git a/ci/docker/python-wheel-windows-vs2019.dockerfile b/ci/docker/python-wheel-windows-vs2019.dockerfile index cab9cbe0fd9ff..50e942fd6bd5c 100644 --- a/ci/docker/python-wheel-windows-vs2019.dockerfile +++ b/ci/docker/python-wheel-windows-vs2019.dockerfile @@ -18,8 +18,6 @@ # NOTE: You must update PYTHON_WHEEL_WINDOWS_IMAGE_REVISION in .env # when you update this file. -# based on mcr.microsoft.com/windows/servercore:ltsc2019 -# contains choco and vs2019 preinstalled ARG base FROM ${base} diff --git a/docker-compose.yml b/docker-compose.yml index e6530c85ac1f7..aa9972988efd1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1303,17 +1303,18 @@ services: command: arrow\\ci\\scripts\\python_wheel_windows_build.bat python-free-threaded-wheel-windows-vs2019: - image: ${REPO}:python-3.13-free-threaded-wheel-windows-vs2019-vcpkg-${VCPKG}-${PYTHON_WHEEL_WINDOWS_IMAGE_REVISION} + image: ${REPO}:python-${PYTHON}-free-threaded-wheel-windows-vs2019-vcpkg-${VCPKG}-${PYTHON_WHEEL_WINDOWS_IMAGE_REVISION} build: args: base: ${REPO}:python-wheel-windows-vs2019-base-vcpkg-${VCPKG}-${PYTHON_WHEEL_WINDOWS_IMAGE_REVISION} + python: ${PYTHON} context: . dockerfile: ci/docker/python-free-threaded-wheel-windows-vs2019.dockerfile # This should make the pushed images reusable, but the image gets rebuilt. # Uncomment if no local cache is available. # cache_from: # - abrarov/msvc-2019:2.11.0 - # - ${REPO}:python-3.13-free-threaded-wheel-windows-vs2019-vcpkg-${VCPKG}-${PYTHON_WHEEL_WINDOWS_IMAGE_REVISION} + # - ${REPO}:python-${PYTHON}-free-threaded-wheel-windows-vs2019-vcpkg-${VCPKG}-${PYTHON_WHEEL_WINDOWS_IMAGE_REVISION} volumes: *python-wheel-windows-vs2019-volumes command: arrow\\ci\\scripts\\python_wheel_windows_build.bat @@ -1336,7 +1337,7 @@ services: command: arrow\\ci\\scripts\\python_wheel_windows_test.bat python-free-threaded-wheel-windows-test: - image: ${REPO}:python-3.13-free-threaded-wheel-windows-test-vs2019-${PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION} + image: ${REPO}:python-${PYTHON}-free-threaded-wheel-windows-test-vs2019-${PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION} build: args: base: ${REPO}:python-wheel-windows-test-vs2019-base-${PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION}