Skip to content

Commit

Permalink
drop removeprefix as it's only available in python3.9 (#4843)
Browse files Browse the repository at this point in the history
  • Loading branch information
dprotaso authored Mar 17, 2022
1 parent 01cf0ac commit f366415
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions hack/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@
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):
Expand Down

0 comments on commit f366415

Please sign in to comment.