Skip to content

Commit

Permalink
Merge pull request pypa#8665 from uranusjr/svn-version-more-robust
Browse files Browse the repository at this point in the history
Improve SVN version parser
  • Loading branch information
sbidoul authored and pradyunsg committed Aug 4, 2020
1 parent 864e2ee commit 22d67dc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/8665.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix SVN version detection for alternative SVN distributions.
4 changes: 3 additions & 1 deletion src/pip/_internal/vcs/subversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,16 @@ def call_vcs_version(self):
# compiled Feb 25 2019, 14:20:39 on x86_64-apple-darwin17.0.0
# svn, version 1.7.14 (r1542130)
# compiled Mar 28 2018, 08:49:13 on x86_64-pc-linux-gnu
# svn, version 1.12.0-SlikSvn (SlikSvn/1.12.0)
# compiled May 28 2019, 13:44:56 on x86_64-microsoft-windows6.2
version_prefix = 'svn, version '
version = self.run_command(['--version'])

if not version.startswith(version_prefix):
return ()

version = version[len(version_prefix):].split()[0]
version_list = version.split('.')
version_list = version.partition('-')[0].split('.')
try:
parsed_version = tuple(map(int, version_list))
except ValueError:
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_vcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,9 @@ 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)),
('svn, version 1.12.0-SlikSvn (SlikSvn/1.12.0)\n'
' compiled May 28 2019, 13:44:56 on x86_64-microsoft-windows6.2',
(1, 12, 0)),
('svn, version 1.9.7 (r1800392)', (1, 9, 7)),
('svn, version 1.9.7a1 (r1800392)', ()),
('svn, version 1.9 (r1800392)', (1, 9)),
Expand Down

0 comments on commit 22d67dc

Please sign in to comment.