Skip to content

Commit 7943a4f

Browse files
committed
Improve check for version string in svn --version
1 parent 87aaae0 commit 7943a4f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

news/7968.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Look for version string in the entire output of svn --version, not just the first line

src/pip/_internal/vcs/subversion.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626

2727
if MYPY_CHECK_RUNNING:
28-
from typing import Optional, Tuple
28+
from typing import Optional, Tuple, Text
2929
from pip._internal.utils.subprocess import CommandArgs
3030
from pip._internal.utils.misc import HiddenText
3131
from pip._internal.vcs.versioncontrol import AuthInfo, RevOptions
@@ -215,7 +215,17 @@ def call_vcs_version(self):
215215
# svn, version 1.7.14 (r1542130)
216216
# compiled Mar 28 2018, 08:49:13 on x86_64-pc-linux-gnu
217217
version_prefix = 'svn, version '
218-
version = self.run_command(['--version'], show_stdout=False)
218+
cmd_output = self.run_command(['--version'], show_stdout=False)
219+
220+
# Split the output by newline, and find the line where
221+
# version_prefix is present
222+
output_lines = cmd_output.split('\n')
223+
version = '' # type: Text
224+
225+
for line in output_lines:
226+
if version_prefix in line:
227+
version = line
228+
219229
if not version.startswith(version_prefix):
220230
return ()
221231

0 commit comments

Comments
 (0)