Fix some Windows CI issues (#9708)

Co-authored-by: Mehrdad <noreply@github.com>
This commit is contained in:
mehrdadn
2020-07-28 18:10:23 -07:00
committed by GitHub
parent 423dc96cc4
commit fb5280f21b
6 changed files with 54 additions and 10 deletions
+27 -5
View File
@@ -1,4 +1,5 @@
import argparse
import errno
import glob
import io
import logging
@@ -31,6 +32,11 @@ SUPPORTED_BAZEL = (3, 2, 0)
ROOT_DIR = os.path.dirname(__file__)
BUILD_JAVA = os.getenv("RAY_INSTALL_JAVA") == "1"
PICKLE5_SUBDIR = os.path.join("ray", "pickle5_files")
THIRDPARTY_SUBDIR = os.path.join("ray", "thirdparty_files")
CLEANABLE_SUBDIRS = [PICKLE5_SUBDIR, THIRDPARTY_SUBDIR]
exe_suffix = ".exe" if sys.platform == "win32" else ""
# .pyd is the extension Python requires on Windows for shared libraries.
@@ -232,7 +238,7 @@ def build(build_python, build_java):
except ImportError:
pass
if not pickle5:
download_pickle5(os.path.join(ROOT_DIR, "ray", "pickle5_files"))
download_pickle5(os.path.join(ROOT_DIR, PICKLE5_SUBDIR))
# Note: We are passing in sys.executable so that we use the same
# version of Python to build packages inside the build.sh script. Note
@@ -243,7 +249,7 @@ def build(build_python, build_java):
subprocess.check_call(
[
sys.executable, "-m", "pip", "install", "-q",
"--target=" + os.path.join(ROOT_DIR, "ray", "thirdparty_files")
"--target=" + os.path.join(ROOT_DIR, THIRDPARTY_SUBDIR)
] + pip_packages,
env=dict(os.environ, CC="gcc"))
@@ -329,10 +335,10 @@ def pip_run(build_ext):
# We also need to install pickle5 along with Ray, so make sure that the
# relevant non-Python pickle5 files get copied.
pickle5_dir = os.path.join(ROOT_DIR, "ray", "pickle5_files")
pickle5_dir = os.path.join(ROOT_DIR, PICKLE5_SUBDIR)
files_to_include += walk_directory(os.path.join(pickle5_dir, "pickle5"))
thirdparty_dir = os.path.join(ROOT_DIR, "ray", "thirdparty_files")
thirdparty_dir = os.path.join(ROOT_DIR, THIRDPARTY_SUBDIR)
files_to_include += walk_directory(thirdparty_dir)
# Copy over the autogenerated protobuf Python bindings.
@@ -355,7 +361,7 @@ def pip_run(build_ext):
def api_main(program, *args):
parser = argparse.ArgumentParser()
choices = ["build", "bazel_version", "help"]
choices = ["build", "bazel_version", "python_versions", "clean", "help"]
parser.add_argument("command", type=str, choices=choices)
parser.add_argument(
"-l",
@@ -381,6 +387,22 @@ def api_main(program, *args):
result = build(**kwargs)
elif parsed_args.command == "bazel_version":
print(".".join(map(str, SUPPORTED_BAZEL)))
elif parsed_args.command == "python_versions":
for version in SUPPORTED_PYTHONS:
# NOTE: On Windows this will print "\r\n" on the command line.
# Strip it out by piping to tr -d "\r".
print(".".join(map(str, version)))
elif parsed_args.command == "clean":
def onerror(function, path, excinfo):
nonlocal result
if excinfo[1].errno != errno.ENOENT:
msg = excinfo[1].strerror
logger.error("cannot remove {}: {}" % (path, msg))
result = 1
for subdir in CLEANABLE_SUBDIRS:
shutil.rmtree(os.path.join(ROOT_DIR, subdir), onerror=onerror)
elif parsed_args.command == "help":
parser.print_help()
else: