Skip to content

Commit

Permalink
Merge pull request #7012 from kpayson64/python_windows_mingw
Browse files Browse the repository at this point in the history
Updated grpcio c extension build for windows to use mingw.
  • Loading branch information
jtattermusch committed Jun 23, 2016
2 parents 60e98ec + c9b7ad0 commit fc74d51
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tools/run_tests/build_artifact_python.bat
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ set NUGET=C:\nuget\nuget.exe

mkdir src\python\grpcio\grpc\_cython\_windows

@rem TODO(atash): maybe we could avoid the grpc_c.(32|64).python shim below if
@rem this used the right python build?
copy /Y vsprojects\Release\grpc_dll.dll src\python\grpcio\grpc\_cython\_windows\grpc_c.32.python || goto :error
copy /Y vsprojects\x64\Release\grpc_dll.dll src\python\grpcio\grpc\_cython\_windows\grpc_c.64.python || goto :error


set PATH=C:\%1;C:\%1\scripts;C:\msys64\mingw%2\bin;%PATH%

pip install --upgrade six
Expand All @@ -50,12 +51,6 @@ pip install -rrequirements.txt
set GRPC_PYTHON_USE_CUSTOM_BDIST=0
set GRPC_PYTHON_BUILD_WITH_CYTHON=1

@rem TODO(atash): maybe we could avoid the grpc_c.(32|64).python shim above if
@rem this used the right python build?
python setup.py bdist_wheel

@rem Build gRPC Python tools
@rem
@rem Because this is windows and *everything seems to hate Windows* we have to
@rem set all of these flags ourselves because Python won't help us (see the
@rem setup.py of the grpcio_tools project).
Expand All @@ -70,6 +65,18 @@ set GRPC_PYTHON_CFLAGS=-fno-wrapv -frtti -std=c++11
python -c "from distutils.cygwinccompiler import get_msvcr; print(get_msvcr()[0])" > temp.txt
set /p PYTHON_MSVCR=<temp.txt
set GRPC_PYTHON_LDFLAGS=-static-libgcc -static-libstdc++ -mcrtdll=%PYTHON_MSVCR% -static -lpthread


@rem Build gRPC
if %2 == 32 (
python setup.py build_ext -c mingw32
) else (
python setup.py build_ext -c mingw32 -DMS_WIN64
)
python setup.py bdist_wheel


@rem Build gRPC Python tools
python tools\distrib\python\make_grpcio_tools.py
if %2 == 32 (
python tools\distrib\python\grpcio_tools\setup.py build_ext -c mingw32
Expand Down

0 comments on commit fc74d51

Please sign in to comment.