Skip to content
This repository has been archived by the owner on Apr 21, 2021. It is now read-only.

Commit

Permalink
Merge pull request pypa#2018 from eckardt/parse-pypy-version-string
Browse files Browse the repository at this point in the history
Parse pypy3 version string containing multiple lines
  • Loading branch information
uranusjr authored Apr 18, 2018
2 parents 3c675bd + c35cb56 commit 09fb7d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pipenv/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def parse_python_version(output):
Note: The micro part would be `'0'` if it's missing from the input string.
"""
version_line = output.split('\n', 1)[0]
version_pattern = re.compile(r'''
^ # Beginning of line.
Python # Literally "Python".
Expand All @@ -207,7 +208,7 @@ def parse_python_version(output):
$ # End of line.
''', re.VERBOSE)

match = version_pattern.match(output)
match = version_pattern.match(version_line)
if not match:
return None
return match.groupdict(default='0')
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def test_python_version_from_non_python(self):
('Python 3.6.2', '3.6.2'),
('Python 3.6.2 :: Continuum Analytics, Inc.', '3.6.2'),
('Python 3.6.20 :: Continuum Analytics, Inc.', '3.6.20'),
('Python 3.5.3 (3f6eaa010fce78cc7973bdc1dfdb95970f08fed2, Jan 13 2018, 18:14:01)\n[PyPy 5.10.1 with GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]', '3.5.3')
],
)
@patch('delegator.run')
Expand Down

0 comments on commit 09fb7d0

Please sign in to comment.