diff --git a/eng/pipelines/templates/steps/install-rex-validation-tool.yml b/eng/pipelines/templates/steps/install-rex-validation-tool.yml index f447b4dfca48..0555944a716b 100644 --- a/eng/pipelines/templates/steps/install-rex-validation-tool.yml +++ b/eng/pipelines/templates/steps/install-rex-validation-tool.yml @@ -2,7 +2,27 @@ steps: - pwsh: | Write-Host "python -m pip install -r eng/scripts/docs/py2docfx_requirements.txt" python -m pip install -r eng/scripts/docs/py2docfx_requirements.txt - # After install py2docfx, + + # Patch py2docfx to add --no-build-isolation to pip download commands. + # When py2docfx downloads sdists with --no-binary=:all:, pip enters build isolation + # and spawns nested subprocesses that inherit --extra-index-url. These nested + # subprocesses hit the Azure DevOps feed without auth, causing 401 errors that + # result in EOFError when pip tries to prompt for credentials in a non-interactive + # environment. Adding --no-build-isolation makes pip reuse the already-installed + # setuptools and wheel from the outer environment, avoiding the auth cascade. + $pipUtilsPath = python -c "import py2docfx.convert_prepare.pip_utils as m; print(m.__file__)" + Write-Host "Patching py2docfx pip_utils.py at: $pipUtilsPath" + $content = Get-Content -Raw $pipUtilsPath + $original = ' download_param.append("--no-binary=:all:")' + $patched = $original + "`n" + ' download_param.append("--no-build-isolation")' + if ($content.Contains($original)) { + $content = $content.Replace($original, $patched) + Set-Content -Path $pipUtilsPath -Value $content -NoNewline + Write-Host "Successfully patched py2docfx to add --no-build-isolation" + } else { + Write-Host "##vso[task.logissue type=warning]Could not find expected pattern in pip_utils.py to patch. py2docfx may have been updated." + } + Write-Host "Testing the install. Running python -m py2docfx -h to display the help" python -m py2docfx -h displayName: Install py2docfx for package validation diff --git a/eng/scripts/docs/py2docfx_requirements.txt b/eng/scripts/docs/py2docfx_requirements.txt index fd2c0a2051f7..a0481f76cebb 100644 --- a/eng/scripts/docs/py2docfx_requirements.txt +++ b/eng/scripts/docs/py2docfx_requirements.txt @@ -1 +1,3 @@ py2docfx==0.1.24 +setuptools==77.0.3 +wheel==0.45.1