Fix CI script on platforms using Python <3.9 (#1635)
Example breakage:
https://buildkite.com/bazel/google-bazel-presubmit/builds/66705#0187ed4a-3b83-4bb9-824a-1aaa62c97034
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index b814035..2e7b6b9 100755
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -2217,7 +2217,7 @@
if not f.startswith(wanted_prefix):
continue
- tags = f.removeprefix(wanted_prefix).split(",")
+ tags = removeprefix(f, wanted_prefix).split(",")
include, exclude = partition_list(tags)
# Skip tests tagged as "manual" by default, unless explicitly requested
@@ -2230,6 +2230,16 @@
return [], ["manual"]
+def removeprefix(s, prefix):
+ def rp(p):
+ if s.startswith(p):
+ return s[len(p):]
+ return s
+
+ func = getattr(s, "removeprefix", rp)
+ return func(prefix)
+
+
def filter_unchanged_targets(
expanded_test_targets, workspace_dir, bazel_binary, diffbase, git_commit
):