Imported Upstream version 1.27.0
[platform/upstream/grpc.git] / tools / run_tests / artifacts / build_artifact_python.bat
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 & mingw compiler
16 set PATH=C:\%1;C:\%1\scripts;C:\msys64\mingw%2\bin;C:\tools\msys64\mingw%2\bin;%PATH%
17
18 python -m pip install --upgrade six
19 @rem some artifacts are broken for setuptools 38.5.0. See https://github.com/grpc/grpc/issues/14317
20 python -m pip install --upgrade setuptools==38.2.4
21 python -m pip install --upgrade cython
22 python -m pip install -rrequirements.txt --user
23
24 set GRPC_PYTHON_BUILD_WITH_CYTHON=1
25
26 @rem Allow build_ext to build C/C++ files in parallel
27 @rem by enabling a monkeypatch. It speeds up the build a lot.
28 set GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS=2
29
30 mkdir -p %ARTIFACTS_OUT%
31 set ARTIFACT_DIR=%cd%\%ARTIFACTS_OUT%
32
33 @rem Set up gRPC Python tools
34 python tools\distrib\python\make_grpcio_tools.py
35
36 @rem Build gRPC Python extensions
37 python setup.py build_ext -c %EXT_COMPILER% || goto :error
38
39 pushd tools\distrib\python\grpcio_tools
40 python setup.py build_ext -c %EXT_COMPILER% || goto :error
41 popd
42
43 @rem Build gRPC Python distributions
44 python setup.py bdist_wheel || goto :error
45
46 pushd tools\distrib\python\grpcio_tools
47 python setup.py bdist_wheel || goto :error
48 popd
49
50 @rem Ensure the generate artifacts are valid.
51 python -m pip install "twine<=2.0"
52 python -m twine check dist\* tools\distrib\python\grpcio_tools\dist\* || goto :error
53
54 xcopy /Y /I /S dist\* %ARTIFACT_DIR% || goto :error
55 xcopy /Y /I /S tools\distrib\python\grpcio_tools\dist\* %ARTIFACT_DIR% || goto :error
56
57 goto :EOF
58
59 :error
60 popd
61 exit /b 1