Skip to content

Commit

Permalink
fix a nasty bug
Browse files Browse the repository at this point in the history
Signed-off-by: Kenneth Reitz <[email protected]>
  • Loading branch information
kennethreitz committed Sep 22, 2017
1 parent 403e74b commit 7d2927f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
9 changes: 5 additions & 4 deletions pipenv/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
44 changes: 20 additions & 24 deletions pipenv/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ class PipCommand(pip.basecommand.Command):
name = 'PipCommand'

constraints = []
pinned_constraints = []
extra_constraints = []

for dep in deps:
Expand All @@ -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()

Expand All @@ -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:
Expand Down

0 comments on commit 7d2927f

Please sign in to comment.