| 1 |
@rem Copyright 2016 gRPC authors. |
| 2 |
@rem |
| 3 |
@rem Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
@rem you may not use this file except in compliance with the License. |
| 5 |
@rem You may obtain a copy of the License at |
| 6 |
@rem |
| 7 |
@rem http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
@rem |
| 9 |
@rem Unless required by applicable law or agreed to in writing, software |
| 10 |
@rem distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
@rem See the License for the specific language governing permissions and |
| 13 |
@rem limitations under the License. |
| 14 |
|
| 15 |
@rem set path to python |
| 16 |
set PATH=C:\%1;C:\%1\scripts;%PATH% |
| 17 |
|
| 18 |
@rem set path to the existed mingw compiler |
| 19 |
set PATH=C:\msys64\mingw%2\bin;C:\tools\msys64\mingw%2\bin;%PATH% |
| 20 |
:end_mingw64_installation |
| 21 |
|
| 22 |
python -m pip install --upgrade six |
| 23 |
@rem some artifacts are broken for setuptools 38.5.0. See https://github.com/grpc/grpc/issues/14317 |
| 24 |
python -m pip install --upgrade setuptools==44.1.1 |
| 25 |
python -m pip install --upgrade cython |
| 26 |
python -m pip install -rrequirements.txt --user |
| 27 |
|
| 28 |
@rem set GRPC_PYTHON_OVERRIDE_CYGWIN_DETECTION_FOR_27=1 |
| 29 |
set GRPC_PYTHON_BUILD_WITH_CYTHON=1 |
| 30 |
|
| 31 |
@rem Allow build_ext to build C/C++ files in parallel |
| 32 |
@rem by enabling a monkeypatch. It speeds up the build a lot. |
| 33 |
@rem Use externally provided GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS value if set. |
| 34 |
if "%GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS%"=="" ( |
| 35 |
set GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS=4 |
| 36 |
) |
| 37 |
|
| 38 |
mkdir -p %ARTIFACTS_OUT% |
| 39 |
set ARTIFACT_DIR=%cd%\%ARTIFACTS_OUT% |
| 40 |
|
| 41 |
@rem Set up gRPC Python tools |
| 42 |
python tools\distrib\python\make_grpcio_tools.py |
| 43 |
|
| 44 |
@rem Build gRPC Python extensions |
| 45 |
python setup.py build_ext -c %EXT_COMPILER% || goto :error |
| 46 |
|
| 47 |
pushd tools\distrib\python\grpcio_tools |
| 48 |
python setup.py build_ext -c %EXT_COMPILER% || goto :error |
| 49 |
popd |
| 50 |
|
| 51 |
@rem Build gRPC Python distributions |
| 52 |
python setup.py bdist_wheel || goto :error |
| 53 |
|
| 54 |
pushd tools\distrib\python\grpcio_tools |
| 55 |
python setup.py bdist_wheel || goto :error |
| 56 |
popd |
| 57 |
|
| 58 |
@rem Ensure the generate artifacts are valid. |
| 59 |
python -m pip install packaging==21.3 twine==3.8.0 |
| 60 |
python -m twine check dist\* tools\distrib\python\grpcio_tools\dist\* || goto :error |
| 61 |
|
| 62 |
xcopy /Y /I /S dist\* %ARTIFACT_DIR% || goto :error |
| 63 |
xcopy /Y /I /S tools\distrib\python\grpcio_tools\dist\* %ARTIFACT_DIR% || goto :error |
| 64 |
|
| 65 |
goto :EOF |
| 66 |
|
| 67 |
:error |
| 68 |
popd |
| 69 |
exit /b 1 |