mirror of
https://github.com/vale981/ray
synced 2025-03-05 10:01:43 -05:00
[BUILD] Use bazel-skylib rule to check bazel version (#20990)
Bazel has a rule for enforcing the version so we can just reuse that. This redundant bazel version check logic in setup.py is also causing issue when building conda package, because conda has its own version of bazel and it doesn't support `--version`.
This commit is contained in:
parent
2410ec5ef0
commit
5b21bc5c93
2 changed files with 5 additions and 13 deletions
|
@ -17,4 +17,6 @@ grpc_extra_deps()
|
|||
|
||||
load("@bazel_skylib//lib:versions.bzl", "versions")
|
||||
|
||||
versions.check(minimum_bazel_version = "3.4.0")
|
||||
# When the bazel version is updated, make sure to update it
|
||||
# in setup.py as well.
|
||||
versions.check(minimum_bazel_version = "4.2.1")
|
||||
|
|
|
@ -13,7 +13,6 @@ import tempfile
|
|||
import zipfile
|
||||
|
||||
from itertools import chain
|
||||
from itertools import takewhile
|
||||
from enum import Enum
|
||||
|
||||
import urllib.error
|
||||
|
@ -23,6 +22,8 @@ import urllib.request
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
SUPPORTED_PYTHONS = [(3, 6), (3, 7), (3, 8), (3, 9)]
|
||||
# When the bazel version is updated, make sure to update it
|
||||
# in WORKSPACE file as well.
|
||||
SUPPORTED_BAZEL = (4, 2, 1)
|
||||
|
||||
ROOT_DIR = os.path.dirname(__file__)
|
||||
|
@ -485,17 +486,6 @@ def build(build_python, build_java, build_cpp):
|
|||
] + pip_packages,
|
||||
env=dict(os.environ, CC="gcc"))
|
||||
|
||||
version_info = bazel_invoke(subprocess.check_output, ["--version"])
|
||||
bazel_version_str = version_info.rstrip().decode("utf-8").split(" ", 1)[1]
|
||||
bazel_version_split = bazel_version_str.split(".")
|
||||
bazel_version_digits = [
|
||||
"".join(takewhile(str.isdigit, s)) for s in bazel_version_split
|
||||
]
|
||||
bazel_version = tuple(map(int, bazel_version_digits))
|
||||
if bazel_version < SUPPORTED_BAZEL:
|
||||
logger.warning("Expected Bazel version {} but found {}".format(
|
||||
".".join(map(str, SUPPORTED_BAZEL)), bazel_version_str))
|
||||
|
||||
bazel_flags = ["--verbose_failures"]
|
||||
if BAZEL_LIMIT_CPUS:
|
||||
n = int(BAZEL_LIMIT_CPUS) # the value must be an int
|
||||
|
|
Loading…
Add table
Reference in a new issue