diff --git a/3.16-rc/windows/windowsservercore-ltsc2022/Dockerfile b/3.16-rc/windows/windowsservercore-ltsc2022/Dockerfile index 3a56cfc71..76d3db465 100644 --- a/3.16-rc/windows/windowsservercore-ltsc2022/Dockerfile +++ b/3.16-rc/windows/windowsservercore-ltsc2022/Dockerfile @@ -8,9 +8,6 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2022 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] -# https://github.com/docker-library/python/pull/557 -ENV PYTHONIOENCODING UTF-8 - # PATH isn't actually set in the Docker image, so we have to set it from within the container RUN $newPath = ('C:\Python;C:\Python\Scripts;{0}' -f $env:PATH); \ Write-Host ('Updating PATH: {0}' -f $newPath); \ diff --git a/3.16-rc/windows/windowsservercore-ltsc2025/Dockerfile b/3.16-rc/windows/windowsservercore-ltsc2025/Dockerfile index 266324f93..0fd8f90f4 100644 --- a/3.16-rc/windows/windowsservercore-ltsc2025/Dockerfile +++ b/3.16-rc/windows/windowsservercore-ltsc2025/Dockerfile @@ -8,9 +8,6 @@ FROM mcr.microsoft.com/windows/servercore:ltsc2025 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] -# https://github.com/docker-library/python/pull/557 -ENV PYTHONIOENCODING UTF-8 - # PATH isn't actually set in the Docker image, so we have to set it from within the container RUN $newPath = ('C:\Python;C:\Python\Scripts;{0}' -f $env:PATH); \ Write-Host ('Updating PATH: {0}' -f $newPath); \ diff --git a/Dockerfile-windows.template b/Dockerfile-windows.template index bd69262f4..38ba650fe 100644 --- a/Dockerfile-windows.template +++ b/Dockerfile-windows.template @@ -1,4 +1,7 @@ {{ + def rcVersion: + env.version | rtrimstr("-rc") + ; def extension: .checksums.windows.url | split(".")[-1] ; @@ -8,9 +11,14 @@ FROM mcr.microsoft.com/windows/{{ env.windowsVariant }}:{{ env.windowsRelease }} SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] +{{ if rcVersion | IN("3.11", "3.12", "3.13", "3.14", "3.15") then ( -}} +{{ # only set PYTHONIOENCODING on versions less than 3.16 -}} # https://github.com/docker-library/python/pull/557 ENV PYTHONIOENCODING UTF-8 +{{ # reproducer: docker run --rm python:{{ env.version }}-windowsservercore-{{ env.windowsRelease }} python -c 'print(chr(0x4e2d))' -}} +{{ # https://github.com/docker-library/python/pull/1144#pullrequestreview-5634536246 -}} +{{ ) else "" end -}} {{ # installer sets path for older python, but needs to be set for the zip download if is_windows_zip then (