Closed nreinicke closed 2 years ago
When running cmake-init on macOS Catalina with Apple Git installed, the following error is raised:
cmake-init
ValueError: invalid literal for int() with base 10: '1 (Apple Git-122'.
ValueError: invalid literal for int() with base 10: '1 (Apple Git-122'
Running git --version yields: git version 2.21.1 (Apple Git-122.3)
git --version
git version 2.21.1 (Apple Git-122.3)
This PR updates the determine_git_version() method to use regex to match the first valid version string from the output of git --version.
determine_git_version()
Testing this on various possible strings:
strings = [ "git version 2.21.1 (Apple Git-122.3)", "git version 2.21.1.windows.0", "git version 2.21.1", "git version 2.21", "git version 0", ]
yields:
(2, 21, 1) (2, 21, 1) (2, 21, 1) (2, 21, 0) None
Thanks! Added via 9d4cea6baade934f63842e97f451514737ee606f, I just edited the commit message a bit.
When running
cmake-init
on macOS Catalina with Apple Git installed, the following error is raised:ValueError: invalid literal for int() with base 10: '1 (Apple Git-122'
.Running
git --version
yields:git version 2.21.1 (Apple Git-122.3)
This PR updates the
determine_git_version()
method to use regex to match the first valid version string from the output ofgit --version
.Testing this on various possible strings:
yields: