mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
add --system support to pipenv check
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
+3
-2
@@ -314,12 +314,13 @@ def run(command, args, three=None, python=False):
|
||||
))
|
||||
@click.option('--three/--two', is_flag=True, default=None, help="Use Python 3/2 when creating virtualenv.")
|
||||
@click.option('--python', default=False, nargs=1, help="Specify which version of Python virtualenv should use.")
|
||||
@click.option('--system', is_flag=True, default=False, help="Use system Python.")
|
||||
@click.option('--unused', nargs=1, default=False, help="Given a code path, show potentially unused dependencies.")
|
||||
@click.option('--style', nargs=1, default=False, help="Given a code path, show Flake8 errors.")
|
||||
@click.argument('args', nargs=-1)
|
||||
def check(three=None, python=False, unused=False, style=False, args=None):
|
||||
def check(three=None, python=False, system=False, unused=False, style=False, args=None):
|
||||
from . import core
|
||||
core.do_check(three=three, python=python, unused=unused, style=style, args=args)
|
||||
core.do_check(three=three, python=python, system=system, unused=unused, style=style, args=args)
|
||||
|
||||
|
||||
@click.command(short_help=u"Displays currently–installed dependency graph information.")
|
||||
|
||||
+10
-4
@@ -2027,10 +2027,11 @@ def do_run(command, args, three=None, python=False):
|
||||
pass
|
||||
|
||||
|
||||
def do_check(three=None, python=False, unused=False, style=False, args=None):
|
||||
def do_check(three=None, python=False, system=False, unused=False, style=False, args=None):
|
||||
|
||||
# Ensure that virtualenv is available.
|
||||
ensure_project(three=three, python=python, validate=False, warn=False)
|
||||
if not system:
|
||||
# Ensure that virtualenv is available.
|
||||
ensure_project(three=three, python=python, validate=False, warn=False)
|
||||
|
||||
if not args:
|
||||
args = []
|
||||
@@ -2099,7 +2100,12 @@ def do_check(three=None, python=False, unused=False, style=False, args=None):
|
||||
path = pep508checker.__file__.rstrip('cdo')
|
||||
path = os.sep.join(__file__.split(os.sep)[:-1] + ['patched', 'safety.zip'])
|
||||
|
||||
c = delegator.run('"{0}" {1} check --json'.format(which('python'), shellquote(path)))
|
||||
if not system:
|
||||
python = which('python')
|
||||
else:
|
||||
python = system_which('python')
|
||||
|
||||
c = delegator.run('"{0}" {1} check --json'.format(python, shellquote(path)))
|
||||
try:
|
||||
results = simplejson.loads(c.out)
|
||||
except ValueError:
|
||||
|
||||
Reference in New Issue
Block a user