diff options
author | Ken Payson <kpayson@google.com> | 2016-06-23 02:38:20 -0700 |
---|---|---|
committer | Ken Payson <kpayson@google.com> | 2016-06-23 02:38:20 -0700 |
commit | c9b7ad0c0a541ac7559bb7081c260de195fe8315 (patch) | |
tree | ecea8bb5b14b414523e2561024e2bf59a606bc76 | |
parent | 60e98ec3feab9cc347d6eacb48fb98cecb88c089 (diff) |
Updated grpcio c extension build for windows to use mingw.
The default compiler for Python c extensions is VS2008
or VS2010 depending on the Python version. Since c-core
moved onto the c99 standard, these compilers are not
compatible.
-rw-r--r-- | tools/run_tests/build_artifact_python.bat | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tools/run_tests/build_artifact_python.bat b/tools/run_tests/build_artifact_python.bat index fea0275426..295347e947 100644 --- a/tools/run_tests/build_artifact_python.bat +++ b/tools/run_tests/build_artifact_python.bat @@ -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 @@ -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). @@ -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 |