From 8cf22ed6a4c611305429f8b83bc9c0dc186a098a Mon Sep 17 00:00:00 2001 From: Knative Prow Robot Date: Thu, 17 Mar 2022 13:54:35 -0700 Subject: [PATCH] drop removeprefix as it's only available in python3.9 (#4846) Co-authored-by: Dave Protasowski --- hack/macros.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hack/macros.py b/hack/macros.py index c462d9977..05d1e3098 100644 --- a/hack/macros.py +++ b/hack/macros.py @@ -9,9 +9,15 @@ from github import Github def print_to_stdout(*vargs): print(*vargs, file = sys.stdout) +def removeprefix(s, prefix): + if s.startswith(prefix): + return s[len(prefix):] + else: + return s[:] + def drop_prefix(tag): - tag = tag.removeprefix("knative-") - tag = tag.removeprefix("v") + tag = removeprefix(tag, "knative-") + tag = removeprefix(tag, "v") return tag def is_major_minor(tag, version):