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
16set PATH=C:\%1;C:\%1\scripts;%PATH%
17
18@rem set path to the existed mingw compiler
19set PATH=C:\msys64\mingw%2\bin;C:\tools\msys64\mingw%2\bin;%PATH%
20:end_mingw64_installation
21
22python -m pip install --upgrade six
23@rem some artifacts are broken for setuptools 38.5.0. See https://github.com/grpc/grpc/issues/14317
24python -m pip install --upgrade setuptools==44.1.1
25python -m pip install --upgrade cython
26python -m pip install -rrequirements.txt --user
27
28@rem set GRPC_PYTHON_OVERRIDE_CYGWIN_DETECTION_FOR_27=1
29set 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.
34if "%GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS%"=="" (
35  set GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS=4
36)
37
38mkdir -p %ARTIFACTS_OUT%
39set ARTIFACT_DIR=%cd%\%ARTIFACTS_OUT%
40
41@rem Set up gRPC Python tools
42python tools\distrib\python\make_grpcio_tools.py
43
44@rem Build gRPC Python extensions
45python setup.py build_ext -c %EXT_COMPILER% || goto :error
46
47pushd tools\distrib\python\grpcio_tools
48python setup.py build_ext -c %EXT_COMPILER% || goto :error
49popd
50
51@rem Build gRPC Python distributions
52python setup.py bdist_wheel || goto :error
53
54pushd tools\distrib\python\grpcio_tools
55python setup.py bdist_wheel || goto :error
56popd
57
58@rem Ensure the generate artifacts are valid.
59python -m pip install packaging==21.3 twine==3.8.0
60python -m twine check dist\* tools\distrib\python\grpcio_tools\dist\* || goto :error
61
62xcopy /Y /I /S dist\* %ARTIFACT_DIR% || goto :error
63xcopy /Y /I /S tools\distrib\python\grpcio_tools\dist\* %ARTIFACT_DIR% || goto :error
64
65goto :EOF
66
67:error
68popd
69exit /b 1
70