diff --git a/tools/internal_ci/helper_scripts/install_python38.ps1 b/tools/internal_ci/helper_scripts/install_python38.ps1 index afe15b73272..e3b82fee1dc 100644 --- a/tools/internal_ci/helper_scripts/install_python38.ps1 +++ b/tools/internal_ci/helper_scripts/install_python38.ps1 @@ -2,6 +2,7 @@ # Install Python 3.8 for x64 and x86 in order to build wheels on Windows. Set-StrictMode -Version 2 +Set-PSDebug -Trace 1 $ErrorActionPreference = 'Stop' # Avoid "Could not create SSL/TLS secure channel" @@ -33,6 +34,21 @@ function Install-Python { if (-Not $?) { throw "The Python installation exited with error!" } + + # Validates Python + $PythonBinary = "$PythonInstallPath/python.exe" + while ($true) { + & $PythonBinary -c 'print(42)' + if ($?) { + Write-Host "Python binary works properly." + break + } + Start-Sleep -Seconds 1 + } + + # Installs pip + & $PythonBinary -m ensurepip --user + Write-Host "Python $PythonVersion installed by $PythonInstaller at $PythonInstallPath." } @@ -51,4 +67,3 @@ $Python38x64Config = @{ PythonInstallerHash = "29ea87f24c32f5e924b7d63f8a08ee8d" } Install-Python @Python38x64Config - diff --git a/tools/run_tests/artifacts/artifact_targets.py b/tools/run_tests/artifacts/artifact_targets.py index 4bf7217ac2d..0d317467b2a 100644 --- a/tools/run_tests/artifacts/artifact_targets.py +++ b/tools/run_tests/artifacts/artifact_targets.py @@ -173,7 +173,7 @@ class PythonArtifact: if 'Python27' in self.py_version: environ['EXT_COMPILER'] = 'mingw32' else: - environ['EXT_COMPILER'] = 'msvc' + environ['EXT_COMPILER'] = 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\cl.exe' # For some reason, the batch script %random% always runs with the same # seed. We create a random temp-dir here dir = ''.join( diff --git a/tools/run_tests/artifacts/build_artifact_python.bat b/tools/run_tests/artifacts/build_artifact_python.bat index 88a331e2782..b1e0ee7d0fb 100644 --- a/tools/run_tests/artifacts/build_artifact_python.bat +++ b/tools/run_tests/artifacts/build_artifact_python.bat @@ -15,10 +15,10 @@ @rem set path to python & mingw compiler set PATH=C:\%1;C:\%1\scripts;C:\msys64\mingw%2\bin;C:\tools\msys64\mingw%2\bin;%PATH% -pip install --upgrade six +python -m pip install --upgrade six @rem some artifacts are broken for setuptools 38.5.0. See https://github.com/grpc/grpc/issues/14317 -pip install --upgrade setuptools==38.2.4 -pip install -rrequirements.txt +python -m pip install --upgrade setuptools==38.2.4 +python -m pip install -rrequirements.txt set GRPC_PYTHON_BUILD_WITH_CYTHON=1