From 1280a54ef37fc1267cd60ae7a6eba4c762dba7ff Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Mon, 6 Jun 2022 17:07:16 -0700 Subject: [PATCH] [upstream_utils]: Make work with Python 3.8 (#4298) str.removesuffix() is only available in Python 3.9, which is not in many Linux installations. --- upstream_utils/upstream_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/upstream_utils/upstream_utils.py b/upstream_utils/upstream_utils.py index 76482d52b4..bd06ad1a67 100644 --- a/upstream_utils/upstream_utils.py +++ b/upstream_utils/upstream_utils.py @@ -19,7 +19,9 @@ def clone_repo(url, treeish, shallow=True): os.chdir(tempfile.gettempdir()) repo = os.path.basename(url) - dest = os.path.join(os.getcwd(), repo).removesuffix(".git") + dest = os.path.join(os.getcwd(), repo) + if dest.endswith(".git"): + dest = dest[:-4] # Clone Git repository into current directory or update it if not os.path.exists(dest):