mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
adcb4974ee
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.
24 lines
584 B
Python
24 lines
584 B
Python
import os
|
|
|
|
from .environments import PIPENV_SHELL_EXPLICIT, PIPENV_SHELL
|
|
from .vendor import shellingham
|
|
|
|
|
|
class ShellDetectionFailure(shellingham.ShellDetectionFailure):
|
|
pass
|
|
|
|
|
|
def _build_info(value):
|
|
return (os.path.splitext(os.path.basename(value))[0], value)
|
|
|
|
|
|
def detect_info():
|
|
if PIPENV_SHELL_EXPLICIT:
|
|
return _build_info(PIPENV_SHELL_EXPLICIT)
|
|
try:
|
|
return shellingham.detect_shell()
|
|
except (shellingham.ShellDetectionFailure, TypeError):
|
|
if PIPENV_SHELL:
|
|
return _build_info(PIPENV_SHELL)
|
|
raise ShellDetectionFailure
|