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

Upgrade Click-Completion and apply Shellingham for shell detection #2363

Merged
merged 4 commits into from
Jun 15, 2018

Conversation

uranusjr
Copy link
Member

@uranusjr uranusjr commented Jun 15, 2018

Fix #2352. I want to do this without manually patching Click-Completion if possible.

https://github.com/pypa/pipenv/projects/3

uranusjr added 2 commits June 15, 2018 16:59
So I can rely on the linter to tell me what to fix.
This introduces an additional environment variable "PIPENV_SHELL". If
set, shell detection is skipped completely. The old "SHELL"
introspection is kept as a fallback if detection fails.
@uranusjr uranusjr changed the title [WIP] Upgrade Click-Completion and apply Shellingham for shell detection Upgrade Click-Completion and apply Shellingham for shell detection Jun 15, 2018
@uranusjr
Copy link
Member Author

This introduces an additional environment variable PIPENV_SHELL. If set, shell detection is skipped completely. The old SHELL introspection is kept as a fallback if detection fails.

A run down of how shell detection works now:

  1. If PIPENV_SHELL is set, use it.
  2. Detect surrounding shell…
    1. (Only on POSIX) The surrounding shell is the login shell. Use the value of SHELL.
    2. Use the detected shell executable.
  3. Detection failed. Check if SHELL is set; if so, use it.
  4. Prompt the user to set PIPENV_SHELL explicitly.

@techalchemy
Copy link
Member

looks good to me

@techalchemy techalchemy merged commit e326ce6 into master Jun 15, 2018
@frostming
Copy link
Contributor

Does this PR work under CPython only?(see the 'ctypes' imports in Shellingham)
I guess the classifier should be removed from setup.py. In fact PyPy is not tested at all.

@techalchemy
Copy link
Member

We rely heavily on ctypes on window and have done so for some time. We use this as a means of shell detection for spawning subshells. This isn’t new, although I’m guessing the complete lack of issues on the topic is a good indicator that things are ok

@uranusjr
Copy link
Member Author

ctypes does exist on PyPy. It is a wrapper of CFFI, and is slow, but works.

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