diff --git a/python/pip_install/repositories.bzl b/python/pip_install/repositories.bzl index 7c70104977..ab29673bc0 100644 --- a/python/pip_install/repositories.bzl +++ b/python/pip_install/repositories.bzl @@ -1,7 +1,6 @@ -"" +"""Dependencies used for pip rules""" load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") # Avoid a load from @bazel_skylib repository as users don't necessarily have it installed load("//third_party/github.com/bazelbuild/bazel-skylib/lib:versions.bzl", "versions") @@ -118,12 +117,13 @@ def pip_install_dependencies(): # repository rules so it's likely that most users get the right error. versions.check("4.0.0") + existing_rules = native.existing_rules() for (name, url, sha256) in _RULE_DEPS: - maybe( - http_archive, - name, - url = url, - sha256 = sha256, - type = "zip", - build_file_content = _GENERIC_WHEEL, - ) + if name not in existing_rules: + http_archive( + name = name, + url = url, + sha256 = sha256, + type = "zip", + build_file_content = _GENERIC_WHEEL, + )