-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Fix pex3 lock export
: re-use --lock
resolver.
#1831
Conversation
Previously the lock export utility was using out-dated logic from the early days of the lock project. Extract a `subset` operation from the lock resolver and have it and lock export share that code. Also properly plumb lock export target selection and validation of exactly one target with updated help and error messages to make it clear that locks can only be exported for a single target. Fixes pex-tool#1826 Closes pex-tool#1645
): | ||
# type: (...) -> Union[SubsetResult, Error] | ||
|
||
with TRACER.timed("Parsing requirements"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was extracted from the lock_resolver here: https://github.com/pantsbuild/pex/pull/1831/files#diff-aad7222a03ff8182eb9c406092214ea24c7811b23dbdb9f47bfedc85aab327d0L240
@@ -123,39 +115,3 @@ def extract_requirement(req): | |||
locked_resolves = attr.ib() # type: SortedTuple[LockedResolve] | |||
local_project_requirement_mapping = attr.ib(eq=False) # type: Mapping[str, Requirement] | |||
source = attr.ib(default=None, eq=False) # type: Optional[str] | |||
|
|||
def select(self, targets): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the entry-point to the out-dated lock selection logic export (and update) were using. Now all removed.
update_requests = [ | ||
ResolveUpdateRequest(target=target, locked_resolve=locked_resolve) | ||
for target, locked_resolve in lock_file.select(targets.unique_targets()) | ||
ResolveUpdateRequest( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<- And this was the flip-over from the out-dated lock selection logic for lock update
which came along for the ride so I could nuke the outdated logic wholesale. The existing update test still pass, vetting this.
Heads up that I'll need 1 more review. Asher took a look, but I'll need maintainer sign off too. |
Previously the lock export utility was using out-dated logic from the
early days of the lock project. Extract a
subset
operation from thelock resolver and have it and lock export share that code.
Also properly plumb lock export target selection and validation of
exactly one target with updated help and error messages to make it clear
that locks can only be exported for a single target.
Fixes #1826
Closes #1645