1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
Commit graph

93 commits

Author SHA1 Message Date
Tzu-ping Chung 8b2b92485c Include Requires-Python dep even with --no-deps 2020-08-26 09:49:25 +08:00
Pradyun Gedam ee4371c386
Merge pull request #8685 from chrahunt/use-preparer-for-lazy-wheels 2020-08-04 18:46:56 +05:30
Pradyun Gedam 4fa31d509f
Merge pull request #8678 from uranusjr/new-resolver-no-deps-extras-install-self 2020-08-04 06:48:11 +05:30
Chris Hunt 6c4d4f3b78 Move _fetch_metadata to RequirementPreparer
The fact that all of this functionality can be put in terms of the
`RequirementPreparer` indicates that, at least at this point, this is
the cleanest place to put this functionality.
2020-08-02 19:36:29 -04:00
Chris Hunt 4e1bff741d Promote Wheel-related assertions to LinkCandidate constructor
These are things we know will be true because of the existing wheel
processing. In the future we may delegate the extraction of these to the
LinkCandidate itself so it doesn't have to be an assertion.
2020-08-02 19:36:28 -04:00
Chris Hunt 9e463916d0 Extract name and version from Wheel link
We happen to know that this is the same treatment that gave us `_name`
and `_version` for Wheels in the first place (in `LinkEvaluator`). It's not
ideal, however the metadata consistency check that occurs in `Candidate`
after creation of a `Distribution` guards us against any deviation in
the name and version during our processing.

Reduces dependence on Candidate.
2020-08-02 19:36:14 -04:00
Chris Hunt defbf82a8f Use link from InstallRequirement
Since when we generate the InstallRequirement we set the link, these
must be the same.

Reduces dependence on Candidate.
2020-08-02 18:40:11 -04:00
Chris Hunt f4603078cf Pass InstallRequirement to _fetch_metadata
Reduces dependence on Candidate.
2020-08-02 18:40:11 -04:00
Chris Hunt f0d4df10eb Propagate lazy_wheel option through RequirementPreparer
Reduces dependence on Candidate (and Resolver (and Factory)).
2020-08-02 18:40:11 -04:00
Chris Hunt 45ab317610 Move call to _fetch_metadata next to call to RequirementPreparer
Since wheels can't be editable, we can move this into LinkCandidate,
closer to `RequirementPreparer.prepare_linked_requirement` into which we
want to integrate `_fetch_metadata`.
2020-08-02 18:40:11 -04:00
Chris Hunt ec5b6d7b80 Remove extra metadata consistency check
Instead of an early return, we fall through to the existing check at the
end of this function. This aligns our treatment of `_fetch_metadata` and
`_prepare_distribution`.
2020-08-02 18:40:11 -04:00
Chris Hunt a72d04f734 Move common processing out of _fetch_metadata
Returning a `Distribution` makes `_fetch_metadata` look more like
`_prepare_distribution`, in preparation for moving it there next.
2020-08-02 18:40:11 -04:00
Chris Hunt 8c3c0ade78 Move _fetch_metadata into _prepare
Since `_prepare` is called in two places, we preserve the
`if self._dist is not None` protection above the new call to
`_fetch_metadata`. The second `if` in `_prepare` handles the early
return required when processing a lazy wheel.
2020-08-02 18:40:09 -04:00
Chris Hunt 4d94ae4c40 Move non-lazy req fallback outside of _fetch_metadata
No change in behavior, we just want to unify "requirements processing"
and moving this function out is a prereq for moving `_fetch_metadata` in.
2020-08-02 18:39:57 -04:00
Chris Hunt 7a5e043776 Remove unnecessary check for _dist
Since `_prepare` now internally validates that `_dist` isn't set, we
don't need to.
2020-08-02 18:39:15 -04:00
Chris Hunt 7289625734 Remove redundant guard variable
Now that `_dist` is only set on success, we can use it to guard against
repeated execution instead of `_prepared`. As a result there are now only
two possible outcomes for calling `dist`:

1. `_dist` set and returned - lazy and non-lazy req
2. `_dist` not set and exception raised - bad lazy or bad non-lazy req
2020-08-02 18:38:13 -04:00
Chris Hunt d957cc94c8 Don't set _dist until it has been validated
Previously a call to `_fetch_metadata` could result in several possible
outcomes:

1. `_dist` set, `_provided` not set, dist returned - for lazy wheels
2. `_dist` set, `_provided` not set, exception - for bad lazy wheels
3. `_dist` not set, `_provided` not set, exception - for non-lazy req
   exceptions
4. `_dist` set, `_provided` not set, exception - for bad non-lazy reqs
5. `_dist` set, `_provided` set, dist returned - for non-lazy reqs

and probably more.

Our intent is to use `_dist` being set as the indicator of "this
requirement has been fully processed successfully" and discard
`_prepared`, since we don't actually rely on any of the other states
(they simply lead to a failure or in the future a retry).
2020-08-02 18:37:50 -04:00
Tzu-ping Chung 32b5e43c79 Flip the flag with another name 2020-08-03 05:28:10 +08:00
Tzu-ping Chung 3ce63a62d7 Ask candidates for dependencies even on --no-deps
ExtrasCandidate need to provide one dependency on the non-extra-ed self.
2020-08-02 16:12:46 +08:00
Nguyễn Gia Phong b795c9a7d6 Abstract away AbstractDistribution in higher-level resolver code 2020-07-26 17:13:04 +07:00
Nguyễn Gia Phong 5d15291274 Use lazy wheel to obtain dep info for new resolver 2020-07-21 16:00:34 +07:00
Nguyễn Gia Phong 2152a51b8c Give metadata consistency check its own method 2020-07-21 16:00:01 +07:00
Tzu-ping Chung 01e0700e68 Skip installing if the version matches locally
This check only applies to explicit requirements since we avoid
downloading the dist from finder altogether when there is a matching
installation (although the check wouldn’t change the behaviour in that
case anyway).

We can do this when we build the `ExplicitRequirement` instead, like how
we did for `SpecifierRequirement`, but that would require us to resolve
the direct requirement’s version eagerly, which I don’t want to.

The implemented approach checks the version only after resolution, at
which point the distribution is already built anyway and the operation
is cheap.
2020-07-06 11:06:14 +08:00
Pradyun Gedam 439e16f106
Merge pull request #8445 from uranusjr/hash-error-message
Set the requirement context on hash error
2020-06-24 18:41:03 +05:30
Pradyun Gedam fb68794188
Merge pull request #8026 from sbidoul/requested-sbi 2020-06-24 18:24:30 +05:30
Paul Moore 809eb3cad3 Fix a merge issue that didn't get caught by Brown Truck 2020-06-18 14:01:49 +01:00
Paul Moore d287033599
Merge pull request #8394 from pfmoore/nr_conflict_message
Improve the message for "Resolution Conflict" errors
2020-06-18 13:45:51 +01:00
Paul Moore a42ed23adc Fix format_for_error for remote URL candidates 2020-06-17 16:47:07 +01:00
Paul Moore 2795742b31 Add handling of inconsistent root requirements 2020-06-17 16:47:04 +01:00
Tzu-ping Chung 78db0ba40b Set the requirement context on hash error
This improves the message shown by the hash error to include the
requirement that caused it.
2020-06-16 14:54:04 +08:00
Tzu-ping Chung 439da2f902 Implement yanked link warning in the new resolver 2020-06-15 16:38:10 +08:00
Paul Moore 7bf78f05df
Merge pull request #8283 from uranusjr/pre-existing-build-directory-fix
Pre-existing build directory fix
2020-06-09 16:47:53 +01:00
Paul Moore d3ce025e8d
Merge pull request #8378 from uranusjr/direct-url-fix
Fix direct URL by always passing the template’s URL values into candidate
2020-06-04 17:31:45 +01:00
Tzu-ping Chung 09a7f271c7 Only attach UUID to build dir for spec candidates
These are the only cases where backtracking can happen. This approach
also accounts for VCS requirements relying on the same ensure function
to do cloning :/
2020-06-04 23:26:19 +08:00
Pradyun Gedam 85ce4dfd2c
Merge pull request #8374 from uranusjr/unsupported-link-with-marker
Correctly apply marker matching logic to all requirements
2020-06-04 11:34:31 +05:30
Tzu-ping Chung e4f870ba25 Raise proper exceptions on metadata mismatch 2020-06-03 03:52:07 +08:00
Tzu-ping Chung a0d12df489 Copy link values from template to candidate's ireq
We need to set the original link so the value is accessible in later
code, when we return the ireq backing the candidate. This is needed for
some parts of the post processing like PEP 610 support, which needs to
record the original, remote URL, not the potentially hit cache link.
2020-06-02 19:12:42 +08:00
Tzu-ping Chung a90fe9bd94 Remove outdated TODO comment 2020-06-02 19:07:12 +08:00
Tzu-ping Chung 1719fc3dcc Merge spec->req constructors
Since both functions now return Optional[Requirement], we can just use
the same implementation.
2020-06-02 12:02:52 +08:00
Tzu-ping Chung 258bd7945e Allow Candidate.iter_dependencies() to yield None 2020-06-02 11:53:08 +08:00
Stéphane Bidoul aa0c167498
Make sure user_supplied is propagated where needed 2020-05-31 18:33:51 +02:00
Pradyun Gedam b5a5bcf13b
Rename parent to template 2020-05-28 18:50:09 +05:30
Tzu-ping Chung 6c6b6a7765 Implement new Provider.find_matches() 2020-05-27 23:10:56 +08:00
Tzu-ping Chung 80f3b3e6e0 This is correct! 2020-05-27 20:19:38 +08:00
Tzu-ping Chung bc9b288b1e Implement wheel cache lookup in the new resolver 2020-05-27 20:19:37 +08:00
Pradyun Gedam 24e4cf7118
Update comments and documentation 2020-05-21 21:47:42 +05:30
Pradyun Gedam 9506a28114
ExtrasCandidate depends on exact base, before optional dependencies 2020-05-21 21:47:42 +05:30
Pradyun Gedam 95347df102
Directly require BaseCandidate in ExtrasCandidate 2020-05-21 21:47:42 +05:30
Tzu-ping Chung e6352bc468 Return package dependencies only if markers match 2020-05-21 16:14:26 +08:00
Tzu-ping Chung c3ac76f66c Turn Candidate.get_dependencies() into iterable
This makes it easier to exclude dependencies when markers don't match.
2020-05-21 15:39:16 +08:00