From c324f1cb61e5616ba57338acbeb4e2baae5237de Mon Sep 17 00:00:00 2001 From: Chandan Singh Date: Tue, 29 Jan 2019 14:58:44 +0000 Subject: testutils/site.py: Support parsing more exotic git versions We use output of `git --version` to determine if we can run some tests that rely on features from newer git versions. Usually, we expect the output to be like: git version 2.17.2 On some platforms, like MacOS, there could be a suffix after the version string, so that it looks something like: git version 2.17.2 (Apple Git-113) This causes things to fail like so: ValueError: invalid literal for int() with base 10: '2 (Apple Git-113)\n' Fix logic around `HAVE_OLD_GIT` such that we split the output of `git --version` without limit on how many times we split. Previously we used to split only twice so the suffixes like `(Apple Git-113)` are not part of the parsed version. --- tests/testutils/site.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testutils/site.py b/tests/testutils/site.py index b7bfa11cf..31bcffbca 100644 --- a/tests/testutils/site.py +++ b/tests/testutils/site.py @@ -18,7 +18,7 @@ try: utils.get_host_tool('git') HAVE_GIT = True out = str(subprocess.check_output(['git', '--version']), "utf-8") - version = tuple(int(x) for x in out.split(' ', 2)[2].split('.')) + version = tuple(int(x) for x in out.split(' ')[2].split('.')) HAVE_OLD_GIT = version < (1, 8, 5) except ProgramNotFoundError: HAVE_GIT = False -- cgit v1.2.1