Fix deps python3 build failure on Windows (#14831)
Build all / build_linux (push) Has been cancelled
Build all / Build Windows ${{ matrix.arch }} (push) Has been cancelled
Build all / build_macos_arch (arm64) (push) Has been cancelled
Build all / build_macos_arch (x86_64) (push) Has been cancelled
Build all / Build macOS Universal (push) Has been cancelled
Build all / Linux x86_64 (push) Has been cancelled
Build all / Linux aarch64 (push) Has been cancelled
Build all / Windows x64 (push) Has been cancelled
Build all / Windows arm64 (push) Has been cancelled
Build all / macOS arm64 (push) Has been cancelled
Build all / Slice check (Linux ${{ vars.SELF_HOSTED && 'x86_64' || 'aarch64' }}) (push) Has been cancelled
Build all / Publish Test Results (push) Has been cancelled
Build all / Flatpak (map[arch:aarch64 runner:ubuntu-24.04-arm]) (push) Has been cancelled
Build all / Flatpak (map[arch:x86_64 runner:ubuntu-24.04]) (push) Has been cancelled
Shellcheck / Shellcheck (push) Has been cancelled

* Fix deps python3 build failure on Windows

* Fix build on other platforms
This commit is contained in:
Noisyfox
2026-07-19 12:23:37 +08:00
committed by GitHub
parent b2a7197a07
commit bb3e18c211
2 changed files with 81 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
From b32e63f75046d186d93ee7d627c978f2f7c892f3 Mon Sep 17 00:00:00 2001
From: Steve Dower <steve.dower@python.org>
Date: Fri, 10 Jul 2026 14:04:00 +0100
Subject: [PATCH] [3.13] gh-153438: Update NuGet download URL (GH-153482)
(GH-153515)
gh-153438: Update NuGet download URL (GH-153482)
(cherry picked from commit 106eb532ea3b243423e62a702719e9d3c0e40c16)
(cherry picked from commit 62eb50d65d538dda5164f9c4a097a896454a0d1c)
Co-authored-by: Steve Dower <steve.dower@python.org>
Co-authored-by: Harjoth Khara <harjoth.khara@gmail.com>
---
Doc/using/windows.rst | 6 +++---
.../Build/2026-07-09-22-45-00.gh-issue-153438.Qr7N2p.rst | 2 ++
PCbuild/find_python.bat | 2 +-
Tools/msi/get_externals.bat | 2 +-
4 files changed, 7 insertions(+), 5 deletions(-)
create mode 100644 Misc/NEWS.d/next/Build/2026-07-09-22-45-00.gh-issue-153438.Qr7N2p.rst
diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst
index 2a507675044666..4800789ca2d6cc 100644
--- a/Doc/using/windows.rst
+++ b/Doc/using/windows.rst
@@ -414,9 +414,9 @@ on using nuget. What follows is a summary that is sufficient for Python
developers.
The ``nuget.exe`` command line tool may be downloaded directly from
-``https://aka.ms/nugetclidl``, for example, using curl or PowerShell. With the
-tool, the latest version of Python for 64-bit or 32-bit machines is installed
-using::
+``https://dist.nuget.org/win-x86-commandline/latest/nuget.exe``, for example,
+using curl or PowerShell. With the tool, the latest version of Python for
+64-bit or 32-bit machines is installed using::
nuget.exe install python -ExcludeVersion -OutputDirectory .
nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory .
diff --git a/Misc/NEWS.d/next/Build/2026-07-09-22-45-00.gh-issue-153438.Qr7N2p.rst b/Misc/NEWS.d/next/Build/2026-07-09-22-45-00.gh-issue-153438.Qr7N2p.rst
new file mode 100644
index 00000000000000..edab8e6ba7b259
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2026-07-09-22-45-00.gh-issue-153438.Qr7N2p.rst
@@ -0,0 +1,2 @@
+Update Windows build and installer tooling and documentation to use the
+current download URL for ``nuget.exe``.
diff --git a/PCbuild/find_python.bat b/PCbuild/find_python.bat
index 0af367a3efafad..9612a2860ef9c3 100644
--- a/PCbuild/find_python.bat
+++ b/PCbuild/find_python.bat
@@ -52,7 +52,7 @@
@set _Py_HOST_PYTHON=%HOST_PYTHON%
@if "%_Py_HOST_PYTHON%"=="" set _Py_HOST_PYTHON=py
@if "%_Py_NUGET%"=="" (set _Py_NUGET=%_Py_EXTERNALS_DIR%\nuget.exe)
-@if "%_Py_NUGET_URL%"=="" (set _Py_NUGET_URL=https://aka.ms/nugetclidl)
+@if "%_Py_NUGET_URL%"=="" (set _Py_NUGET_URL=https://dist.nuget.org/win-x86-commandline/latest/nuget.exe)
@if NOT exist "%_Py_NUGET%" (
@if not "%_Py_Quiet%"=="1" @echo Downloading nuget...
@rem NB: Must use single quotes around NUGET here, NOT double!
diff --git a/Tools/msi/get_externals.bat b/Tools/msi/get_externals.bat
index f6602ce9588ff4..c7c7e9f470bc25 100644
--- a/Tools/msi/get_externals.bat
+++ b/Tools/msi/get_externals.bat
@@ -6,7 +6,7 @@ set HERE=%~dp0
if "%PCBUILD%"=="" (set PCBUILD=%HERE%..\..\PCbuild\)
if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%HERE%..\..\externals\windows-installer)
if "%NUGET%"=="" (set NUGET=%EXTERNALS_DIR%\..\nuget.exe)
-if "%NUGET_URL%"=="" (set NUGET_URL=https://aka.ms/nugetclidl)
+if "%NUGET_URL%"=="" (set NUGET_URL=https://dist.nuget.org/win-x86-commandline/latest/nuget.exe)
set DO_FETCH=true
set DO_CLEAN=false
+10
View File
@@ -7,7 +7,16 @@ string(REGEX REPLACE "^([0-9]+\\.[0-9]+)\\..*" "\\1" _python_version_short "${_p
set(_python_url "https://www.python.org/ftp/python/${_python_version}/Python-${_python_version}.tar.xz")
set(_python_sha256 "c08bc65a81971c1dd5783182826503369466c7e67374d1646519adf05207b684")
set(_patch_cmd "")
if(WIN32)
# Fix python build failure on Windows if python is not available, due to wrong nuget download URL
# See https://github.com/python/cpython/issues/153438
# Patch from https://github.com/python/cpython/pull/153608
# This patch has not been merged to 3.12 yet so we need to apply it manually
set(_patch_cmd git init && ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/01-windows-nuget.patch)
if(MSVC_VERSION EQUAL 1800)
set(_python_platform_toolset v120)
elseif(MSVC_VERSION EQUAL 1900)
@@ -253,6 +262,7 @@ endif()
ExternalProject_Add(dep_python3
URL "${_python_url}"
URL_HASH SHA256=${_python_sha256}
PATCH_COMMAND ${_patch_cmd}
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/python3
BUILD_IN_SOURCE ON
CONFIGURE_COMMAND ${_conf_cmd}