Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse pypy3 version string containing multiple lines #2018

Merged
merged 1 commit into from
Apr 18, 2018

Conversation

eckardt
Copy link
Contributor

@eckardt eckardt commented Apr 18, 2018

Thanks for this great tool. It makes using python much more fun.

I ran into the following issue when attempting to use it with pypy3.

$ pipenv --python /usr/local/bin/pypy3
Creating a virtualenv for this project…
Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/11.10.0/libexec/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv==11.10.0', 'console_scripts', 'pipenv')()
  File "/usr/local/Cellar/pipenv/11.10.0/libexec/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/11.10.0/libexec/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/pipenv/11.10.0/libexec/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/usr/local/Cellar/pipenv/11.10.0/libexec/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/pipenv/11.10.0/libexec/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/11.10.0/libexec/lib/python3.6/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/Cellar/pipenv/11.10.0/libexec/lib/python3.6/site-packages/pipenv/cli.py", line 235, in cli
    three=three, python=python, warn=True, site_packages=site_packages
  File "/usr/local/Cellar/pipenv/11.10.0/libexec/lib/python3.6/site-packages/pipenv/core.py", line 604, in ensure_project
    three=three, python=python, site_packages=site_packages
  File "/usr/local/Cellar/pipenv/11.10.0/libexec/lib/python3.6/site-packages/pipenv/core.py", line 553, in ensure_virtualenv
    do_create_virtualenv(python=python, site_packages=site_packages)
  File "/usr/local/Cellar/pipenv/11.10.0/libexec/lib/python3.6/site-packages/pipenv/core.py", line 901, in do_create_virtualenv
    crayons.green('({0})'.format(python_version(python))),
  File "/usr/local/Cellar/pipenv/11.10.0/libexec/lib/python3.6/site-packages/pipenv/utils.py", line 218, in python_version
    return u'{major}.{minor}.{micro}'.format(**version)
TypeError: format() argument after ** must be a mapping, not NoneType

It looks like the version string generated from pypy3 is unexpected because it contains multiple lines.

$ /usr/local/bin/pypy3 --version
Python 3.5.3 (3f6eaa010fce78cc7973bdc1dfdb95970f08fed2, Jan 13 2018, 18:14:01)
[PyPy 5.10.1 with GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]

PEP 440 at https://www.python.org/dev/peps/pep-0440/ is not very specific when it comes to the question of having more than one line as the version string, but we can just consider the first line only.

@uranusjr
Copy link
Member

LGTM.

@uranusjr uranusjr merged commit 09fb7d0 into pypa:master Apr 18, 2018
@eckardt eckardt deleted the parse-pypy-version-string branch April 18, 2018 11:28
@techalchemy
Copy link
Member

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants