Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cover double dependency on a prerelease (work in progress) #1732

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pipenv/patched/notpip/req/req_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def _check_skip_installed(self, req_to_install, finder):
elif self.upgrade_strategy == "only-if-needed":
skip_reason = 'not upgraded as not directly required'
else:
skip_reason = 'already satisfied'
skip_reason = 'already satisfied123'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?


return skip_reason
else:
Expand Down
11 changes: 11 additions & 0 deletions pipenv/patched/piptools/repositories/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,22 @@ def find_best_match(self, ireq, prereleases=None):

all_candidates = self.find_all_candidates(ireq.name)
candidates_by_version = lookup_table(all_candidates, key=lambda c: c.version, unique=True)
import click
click.echo("\n====START\n", err=True)
click.echo("ireq={!r}".format(ireq), err=True)
click.echo("all_candidates={!r}".format(all_candidates), err=True)
click.echo("prereleases={!r}".format(prereleases), err=True)

matching_versions = ireq.specifier.filter((candidate.version for candidate in all_candidates),
prereleases=prereleases)

# Reuses pip's internal candidate sort key to sort

click.echo("candidates_by_version={!r}".format(candidates_by_version), err=True)
click.echo("matching_versions={!r}".format(matching_versions), err=True)
matching_candidates = [candidates_by_version[ver] for ver in matching_versions]
click.echo("matching_candidates={!r}\n".format(matching_candidates), err=True)
click.echo("\n====END\n", err=True)
if not matching_candidates:
raise NoCandidateFound(ireq, all_candidates)
best_candidate = max(matching_candidates, key=self.finder._candidate_sort_key)
Expand Down
1 change: 1 addition & 0 deletions pipenv/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ def resolve_deps(
except RuntimeError:
sys.exit(1)
for result in resolved_tree:
print("resolve_deps 3", file=sys.stderr)
if not result.editable:
name = pep423_name(result.name)
version = clean_pkg_version(result.specifier)
Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/pip9/req/req_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def _check_skip_installed(self, req_to_install, finder):
elif self.upgrade_strategy == "only-if-needed":
skip_reason = 'not upgraded as not directly required'
else:
skip_reason = 'already satisfied'
skip_reason = 'already satisfied456'

return skip_reason
else:
Expand Down
Binary file not shown.
Binary file not shown.
41 changes: 41 additions & 0 deletions tests/test_pipenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -1286,3 +1286,44 @@ def test_resolver_unique_markers(self, pypi):
yarl = p.lockfile['default']['yarl']
assert 'markers' in yarl
assert yarl['markers'] == "python_version in '3.4, 3.5, 3.6'"
assert c.out == 'foo\n'
assert c.err == ''

@pytest.mark.install
@pytest.mark.local_file
def test_install_pinned_range_preversion(self, pypi):
with PipenvInstance(pypi=pypi) as p:
target_package = 'py2neo'
preversion = '==4.0.0b1'
transitive_pkg_name = 'neo4j-driver'
transitive_pkg_pinned_version = '==1.1.0rc1'
transitive_pkg_version = '==1.1.0rc1'
c = p.pipenv('install {0}{1}'.format(target_package, preversion))
assert c.return_code == 0
c = p.pipenv('install {0}{1}'.format(transitive_pkg_name, transitive_pkg_version))
assert c.return_code == 0
assert target_package in p.pipfile['packages']
assert p.pipfile['packages'][target_package] == preversion
assert target_package in p.lockfile['default']
assert transitive_pkg_name in p.lockfile['default']
assert p.lockfile['default'][transitive_pkg_name]['version'] == transitive_pkg_pinned_version

@pytest.mark.install
@pytest.mark.local_file
def test_install_pinned_pinned_preversion(self, pypi):
with PipenvInstance(pypi=pypi) as p:
target_package = 'py2neo'
preversion = '==4.0.0b1'
transitive_pkg_name = 'neo4j-driver'
transitive_pkg_pinned_version = '==1.1.0rc1'
transitive_pkg_version = '>=1.1.0rc1'
c = p.pipenv('install --verbose {0}{1}'.format(target_package, preversion))
assert c.return_code == 0
c = p.pipenv('install --verbose {0}{1}'.format(transitive_pkg_name, transitive_pkg_version))
assert c.return_code == 0
assert target_package in p.pipfile['packages']
assert p.pipfile['packages'][target_package] == preversion
assert target_package in p.lockfile['default']
assert transitive_pkg_name in p.lockfile['default']
assert p.lockfile['default'][transitive_pkg_name]['version'] == transitive_pkg_pinned_version
assert False