Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
2017-09-14 10:29:41 -04:00
parent 46c2748459
commit 835d935782
+12 -1
View File
@@ -1017,8 +1017,19 @@ def which_pip(allow_global=False):
def system_which(command):
"""Emulates the system's which. Returns None is not found."""
c = delegator.run('{0} {1}'.format('which' if not os.name == 'nt' else 'where', command))
_which = 'which' if not os.name == 'nt' else 'where'
c = delegator.run('{0} {1}'.format(_which, command))
try:
# Which Not found...
if c.return_code == 127:
click.echo(
'{}: the {} system utility is required for Pipenv to operate properly.'
'\n Please install it.'.format(
crayons.red('Warning', bold=True),
crayons.red(_which)
)
)
assert c.return_code == 0
except AssertionError:
return None