diff --git a/news/7968.bugfix b/news/7968.bugfix new file mode 100644 index 00000000000..d6959730ab3 --- /dev/null +++ b/news/7968.bugfix @@ -0,0 +1 @@ +Look for version string in the entire output of svn --version, not just the first line diff --git a/src/pip/_internal/vcs/subversion.py b/src/pip/_internal/vcs/subversion.py index 0ec65974492..d0fe3cd9df9 100644 --- a/src/pip/_internal/vcs/subversion.py +++ b/src/pip/_internal/vcs/subversion.py @@ -25,7 +25,7 @@ if MYPY_CHECK_RUNNING: - from typing import Optional, Tuple + from typing import Optional, Tuple, Text from pip._internal.utils.subprocess import CommandArgs from pip._internal.utils.misc import HiddenText from pip._internal.vcs.versioncontrol import AuthInfo, RevOptions @@ -215,7 +215,18 @@ def call_vcs_version(self): # svn, version 1.7.14 (r1542130) # compiled Mar 28 2018, 08:49:13 on x86_64-pc-linux-gnu version_prefix = 'svn, version ' - version = self.run_command(['--version'], show_stdout=False) + cmd_output = self.run_command(['--version'], show_stdout=False) + + # Split the output by newline, and find the first line where + # version_prefix is present + output_lines = cmd_output.split('\n') + version = '' # type: Text + + for line in output_lines: + if version_prefix in line: + version = line + break + if not version.startswith(version_prefix): return () diff --git a/tests/unit/test_vcs.py b/tests/unit/test_vcs.py index 590cb5c0b75..166585db385 100644 --- a/tests/unit/test_vcs.py +++ b/tests/unit/test_vcs.py @@ -443,6 +443,18 @@ def test_subversion__call_vcs_version(): ('svn, version 1.10.3 (r1842928)\n' ' compiled Feb 25 2019, 14:20:39 on x86_64-apple-darwin17.0.0', (1, 10, 3)), + ('Warning: Failed to set locale category LC_NUMERIC to en_IN.\n' + 'Warning: Failed to set locale category LC_TIME to en_IN.\n' + 'svn, version 1.10.3 (r1842928)\n' + ' compiled Feb 25 2019, 14:20:39 on x86_64-apple-darwin17.0.0', + (1, 10, 3)), + ('Warning: Failed to set locale category LC_NUMERIC to en_IN.\n' + 'Warning: Failed to set locale category LC_TIME to en_IN.\n' + 'svn, version 1.10.3 (r1842928)\n' + ' compiled Feb 25 2019, 14:20:39 on x86_64-apple-darwin17.0.0' + 'svn, version 1.11.3 (r1842928)\n' + ' compiled Feb 25 2019, 14:20:39 on x86_64-apple-darwin17.0.0', + (1, 10, 3)), ('svn, version 1.9.7 (r1800392)', (1, 9, 7)), ('svn, version 1.9.7a1 (r1800392)', ()), ('svn, version 1.9 (r1800392)', (1, 9)),