small python ray
This commit is contained in:
commit
e02e80708a
15 changed files with 1261 additions and 0 deletions
0
bazel/BUILD
Normal file
0
bazel/BUILD
Normal file
36
bazel/tools.bzl
Normal file
36
bazel/tools.bzl
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
def copy_to_workspace(name, srcs, dstdir = ""):
|
||||
if dstdir.startswith("/") or dstdir.startswith("\\"):
|
||||
fail("Subdirectory must be a relative path: " + dstdir)
|
||||
src_locations = " ".join(["$(locations %s)" % (src,) for src in srcs])
|
||||
native.genrule(
|
||||
name = name,
|
||||
srcs = srcs,
|
||||
outs = [name + ".out"],
|
||||
# Keep this Bash script equivalent to the batch script below (or take out the batch script)
|
||||
cmd = r"""
|
||||
mkdir -p -- {dstdir}
|
||||
for f in {locations}; do
|
||||
rm -f -- {dstdir}$${{f##*/}}
|
||||
cp -f -- "$$f" {dstdir}
|
||||
done
|
||||
date > $@
|
||||
""".format(
|
||||
locations = src_locations,
|
||||
dstdir = "." + ("/" + dstdir.replace("\\", "/")).rstrip("/") + "/",
|
||||
),
|
||||
# Keep this batch script equivalent to the Bash script above (or take out the batch script)
|
||||
cmd_bat = """
|
||||
(
|
||||
if not exist {dstdir} mkdir {dstdir}
|
||||
) && (
|
||||
for %f in ({locations}) do @(
|
||||
(if exist {dstdir}%~nxf del /f /q {dstdir}%~nxf) &&
|
||||
copy /B /Y %f {dstdir} >NUL
|
||||
)
|
||||
) && >$@ echo %TIME%
|
||||
""".replace("\r", "").replace("\n", " ").format(
|
||||
locations = src_locations,
|
||||
dstdir = "." + ("\\" + dstdir.replace("/", "\\")).rstrip("\\") + "\\",
|
||||
),
|
||||
local = 1,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue