[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.
This commit is contained in:
Peter Johnson
2022-06-06 17:07:16 -07:00
committed by GitHub
parent f2d243fa68
commit 1280a54ef3

View File

@@ -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):