mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00

* Get rid of 'index' lines in patches, which are unnecessary and likely wrong anyway (esp. when there are multiple patches) * Simplify patches to remove unnecessary context and make them more robust
36 lines
1.8 KiB
Diff
36 lines
1.8 KiB
Diff
diff --git bazel/cython_library.bzl bazel/cython_library.bzl
|
|
--- bazel/cython_library.bzl
|
|
+++ bazel/cython_library.bzl
|
|
@@ -10,14 +10,16 @@
|
|
-def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs):
|
|
+def pyx_library(name, deps=[], copts=[], cc_kwargs={}, 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
|
|
- pair. Then builds a shared object for each, passing "deps" to each cc_binary
|
|
- rule (includes Python headers by default). Finally, creates a py_library rule
|
|
- with the shared objects and any pure Python "srcs", with py_deps as its
|
|
- dependencies; the shared objects can be imported like normal Python files.
|
|
+ pair. Then builds a shared object for each, passing "deps" and `**cc_kwargs`
|
|
+ to each cc_binary rule (includes Python headers by default). Finally, creates
|
|
+ a py_library rule with the shared objects and any pure Python "srcs", with py_deps
|
|
+ as its dependencies; the shared objects can be imported like normal Python files.
|
|
|
|
Args:
|
|
name: Name for the rule.
|
|
deps: C/C++ dependencies of the Cython (e.g. Numpy headers).
|
|
+ copts: C/C++ compiler options for Cython
|
|
+ cc_kwargs: cc_binary extra arguments such as linkstatic, linkopts, features
|
|
py_deps: Pure Python dependencies of the final library.
|
|
srcs: .py, .pyx, or .pxd files to either compile or pass through.
|
|
@@ -58,6 +60,8 @@ def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs):
|
|
native.cc_binary(
|
|
name=shared_object_name,
|
|
- srcs=[stem + ".cpp"],
|
|
+ srcs=[stem + ".cpp"] + cc_kwargs.pop("srcs", []),
|
|
+ copts=copts,
|
|
deps=deps + ["@local_config_python//:python_headers"],
|
|
linkshared=1,
|
|
+ **cc_kwargs
|
|
)
|
|
--
|