Remove noop python command in pyx_library rule. (#15808)

* Remove noop python command in pyx_library rule.
This commit is contained in:
Gunhan Gulsoy 2018-01-03 12:54:38 -08:00 committed by Shanqing Cai
parent 5249342883
commit 020001e1e3

View File

@ -67,16 +67,14 @@ def pyx_library(
pxd_srcs.append(src)
# Invoke cython to produce the shared object libraries.
cpp_outs = [src.split(".")[0] + ".cpp" for src in pyx_srcs]
native.genrule(
name = name + "_cython_translation",
srcs = pyx_srcs,
outs = cpp_outs,
cmd = ("PYTHONHASHSEED=0 $(location @cython//:cython_binary) --cplus $(SRCS)"
# Rename outputs to expected location.
+ """ && python -c 'import shutil, sys; n = len(sys.argv); [shutil.copyfile(src.split(".")[0] + ".cpp", dst) for src, dst in zip(sys.argv[1:], sys.argv[1+n//2:])]' $(SRCS) $(OUTS)"""),
tools = ["@cython//:cython_binary"] + pxd_srcs,
)
for filename in pyx_srcs:
native.genrule(
name = filename + "_cython_translation",
srcs = [filename],
outs = [filename.split(".")[0] + ".cpp"],
cmd = "PYTHONHASHSEED=0 $(location @cython//:cython_binary) --cplus $(SRCS) --output-file $(OUTS)",
tools = ["@cython//:cython_binary"] + pxd_srcs,
)
shared_objects = []
for src in pyx_srcs: