From 7d2927f3ce9e5e88f232519ef9fc3277f0dc96bc Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 22 Sep 2017 18:01:11 -0400 Subject: [PATCH] fix a nasty bug Signed-off-by: Kenneth Reitz --- pipenv/cli.py | 9 +++++---- pipenv/utils.py | 44 ++++++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 3566e8410c..2d2607182b 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -710,11 +710,11 @@ def do_install_dependencies( procs = [] - deps_list = progress.bar(deps_list, label=INSTALL_LABEL if os.name != 'nt' else '') + deps_list_bar = progress.bar(deps_list, label=INSTALL_LABEL if os.name != 'nt' else '') - for dep, ignore_hash in deps_list: + for dep, ignore_hash in deps_list_bar: - if len(procs) < PIPENV_MAX_SUBPROCESS: + if len(procs) < PIPENV_MAX_SUBPROCESS or (not len(procs) == len(deps_list - 1)): # Use a specific index, if specified. index = None if ' -i ' in dep: @@ -735,7 +735,8 @@ def do_install_dependencies( c.dep = dep procs.append(c) - else: + + if len(procs) >= PIPENV_MAX_SUBPROCESS or len(procs) == len(deps_list): for c in procs: if concurrent: diff --git a/pipenv/utils.py b/pipenv/utils.py index 647608a8af..10dd81494e 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -412,7 +412,6 @@ class PipCommand(pip.basecommand.Command): name = 'PipCommand' constraints = [] - pinned_constraints = [] extra_constraints = [] for dep in deps: @@ -438,12 +437,9 @@ class PipCommand(pip.basecommand.Command): # if 'python_version' in dep: # python_version_lookup[constraint.name] = dep.split(';')[1].strip().split('python_version ')[1] - if '==' not in dep: - constraints.append(constraint) - constraints.extend(extra_constraints) - else: - pinned_constraints.append(constraint) - pinned_constraints.extend(extra_constraints) + + constraints.append(constraint) + constraints.extend(extra_constraints) pip_command = get_pip_command() @@ -464,23 +460,23 @@ class PipCommand(pip.basecommand.Command): results = [] resolved_tree = set() - for constraint_set in (constraints, pinned_constraints): - resolver = Resolver(constraints=constraint_set, repository=pypi, clear_caches=clear, allow_unsafe=True) - # pre-resolve instead of iterating to avoid asking pypi for hashes of editable packages - try: - resolved_tree.update(resolver.resolve()) - except (NoCandidateFound, DistributionNotFound) as e: - click.echo( - '{0}: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.\n ' - 'You can use {1} to bypass this mechanism, then run {2} to inspect the situation.' - ''.format( - crayons.red('Warning', bold=True), - crayons.red('$ pipenv install --skip-lock'), - crayons.red('$ pipenv graph') - ), - err=True) - click.echo(crayons.blue(e)) - sys.exit(1) + + resolver = Resolver(constraints=constraints, repository=pypi, clear_caches=clear, allow_unsafe=True) + # pre-resolve instead of iterating to avoid asking pypi for hashes of editable packages + try: + resolved_tree.update(resolver.resolve()) + except (NoCandidateFound, DistributionNotFound) as e: + click.echo( + '{0}: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.\n ' + 'You can use {1} to bypass this mechanism, then run {2} to inspect the situation.' + ''.format( + crayons.red('Warning', bold=True), + crayons.red('$ pipenv install --skip-lock'), + crayons.red('$ pipenv graph') + ), + err=True) + click.echo(crayons.blue(e)) + sys.exit(1) for result in resolved_tree: if not result.editable: