Skip to content

Commit

Permalink
Patch Cython in grpc to use our COPTS (ray-project#6223)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrdadn authored and pcmoritz committed Nov 21, 2019
1 parent 57e101e commit ba86c75
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@ pyx_library(
"python/ray/includes/*.pxd",
"python/ray/includes/*.pxi",
]),
copts = COPTS,
deps = [
"//:core_worker_lib",
"//:raylet_lib",
Expand Down
3 changes: 3 additions & 0 deletions bazel/ray_deps_setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def ray_deps_setup():
commit = "93e8830070e9afcbaa992c75817009ee3f4b63a0",
remote = "https://github.com/grpc/grpc.git",
shallow_since = "1571118670 -0700",
patches = [
"//thirdparty/patches:grpc-cython-copts.patch",
],
)

git_repository(
Expand Down
Empty file added thirdparty/patches/BUILD
Empty file.
30 changes: 30 additions & 0 deletions thirdparty/patches/grpc-cython-copts.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git bazel/cython_library.bzl bazel/cython_library.bzl
index 48b41d74e8..6084734f59 100644
--- bazel/cython_library.bzl
+++ bazel/cython_library.bzl
@@ -7,7 +7,7 @@
# been written at cython/cython and tensorflow/tensorflow. We branch from
# Tensorflow's version as it is more actively maintained and works for gRPC
# Python's needs.
-def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs):
+def pyx_library(name, deps=[], copts=[], py_deps=[], srcs=[], **kwargs):
"""Compiles a group of .pyx / .pxd / .py files.

First runs Cython to create .cpp files for each input .pyx or .py + .pxd
@@ -19,6 +19,7 @@ def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs):
Args:
name: Name for the rule.
deps: C/C++ dependencies of the Cython (e.g. Numpy headers).
+ copts: C/C++ compiler options for Cython
py_deps: Pure Python dependencies of the final library.
srcs: .py, .pyx, or .pxd files to either compile or pass through.
**kwargs: Extra keyword arguments passed to the py_library.
@@ -58,6 +59,7 @@ def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs):
native.cc_binary(
name=shared_object_name,
srcs=[stem + ".cpp"],
+ copts=copts,
deps=deps + ["@local_config_python//:python_headers"],
linkshared=1,
)
--

0 comments on commit ba86c75

Please sign in to comment.