1+ param (
2+ [string ]$pythonVersion
3+ )
4+ $versionParts = $pythonVersion -split ' \.' # Splitting by dot
5+ $versionMinor = [int ]$versionParts [1 ]
6+
7+ Write-Host " === Upgrading pip and installing build dependencies ==="
8+ python - m pip install -- upgrade pip setuptools wheel cython
9+
10+ Write-Host " === Cloning gRPC repo ==="
11+ if (Test-Path grpc) {
12+ Remove-Item - Recurse - Force grpc
13+ }
14+ git clone -- recursive https:// github.com / grpc/ grpc
15+
16+ Write-Host " === Building grpcio from source ==="
17+ Set-Location grpc
18+ $env: GRPC_PYTHON_BUILD_WITH_CYTHON = " 1"
19+
20+ # Build the wheel into dist/
21+ python - m pip wheel . - w dist
22+
23+ # Log contents of dist
24+ Write-Host " === Checking dist directory ==="
25+ if (Test-Path dist) {
26+ Get-ChildItem dist
27+ } else {
28+ Write-Host " dist/ directory not found!"
29+ }
30+
31+ # Log and install grpc
32+ $grpcWheel = Get-ChildItem dist\grpcio-* .whl | Select-Object - First 1
33+ Write-Host " Built grpcio wheel: $ ( $grpcWheel.Name ) "
34+ Write-Host " === Install grpcio wheel $ ( $grpcWheel.Name ) into root ==="
35+ $grpcWheel = Get-ChildItem dist\grpcio-* .whl | Select-Object - First 1
36+ python - m pip install $grpcWheel.FullName
37+
38+ cd ..
39+
40+ # Change back to project root
41+ Set-Location workers
42+
43+ Write-Host " === Install other deps into root ==="
44+ python - m pip install .
45+ python - m pip install grpcio- tools== 1.70 .0
46+
47+ $depsPath = Join-Path - Path $env: BUILD_SOURCESDIRECTORY - ChildPath " deps"
48+
49+ # Install both grpc wheels into deps
50+ Write-Host " === Installing grpcio into deps/ ==="
51+ python - m pip install $grpcWheel.FullName -- target $depsPath
52+
53+ Write-Host " === Installing other deps into deps/ ==="
54+ python - m pip install -- upgrade pip setuptools wheel cython -- target $depsPath
55+ python - m pip install . azure- functions -- no- compile -- target $depsPath -- find-links ..\grpc\dist
56+ python - m pip install grpcio- tools== 1.70 .0 -- no- compile -- target $depsPath -- find-links ..\grpc\dist
57+
58+ Write-Host " === Install invoke and build protos ==="
59+ python - m pip install invoke
60+ cd tests
61+ python - m invoke - c test_setup build-protos
62+
63+ Write-Host " === Copying .artifactignore ==="
64+ cd ..
65+ Copy-Item - Path " .artifactignore" - Destination $depsPath.ToString ()
66+
67+ Write-Host " === Copying protos ==="
68+ if ($versionMinor -lt 13 ) {
69+ $protosPath = Join-Path - Path $depsPath - ChildPath " azure_functions_worker/protos"
70+ Copy-Item - Path " azure_functions_worker/protos/*" - Destination $protosPath.ToString () - Recurse - Force
71+ } else {
72+ $protosPath = Join-Path - Path $depsPath - ChildPath " proxy_worker/protos"
73+ Copy-Item - Path " proxy_worker/protos/*" - Destination $protosPath.ToString () - Recurse - Force
74+ }
0 commit comments