From 22d67dc261461db99242b72bc56a3a9318aa2e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sat, 1 Aug 2020 14:13:54 +0200 Subject: [PATCH] Merge pull request #8665 from uranusjr/svn-version-more-robust Improve SVN version parser --- news/8665.bugfix | 1 + src/pip/_internal/vcs/subversion.py | 4 +++- tests/unit/test_vcs.py | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 news/8665.bugfix diff --git a/news/8665.bugfix b/news/8665.bugfix new file mode 100644 index 00000000000..0ce45846360 --- /dev/null +++ b/news/8665.bugfix @@ -0,0 +1 @@ +Fix SVN version detection for alternative SVN distributions. diff --git a/src/pip/_internal/vcs/subversion.py b/src/pip/_internal/vcs/subversion.py index 14825f791a4..ab134970b05 100644 --- a/src/pip/_internal/vcs/subversion.py +++ b/src/pip/_internal/vcs/subversion.py @@ -213,6 +213,8 @@ 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']) @@ -220,7 +222,7 @@ def call_vcs_version(self): 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: diff --git a/tests/unit/test_vcs.py b/tests/unit/test_vcs.py index 590cb5c0b75..93598c36739 100644 --- a/tests/unit/test_vcs.py +++ b/tests/unit/test_vcs.py @@ -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)),