-
-
Notifications
You must be signed in to change notification settings - Fork 292
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 subset
.
#2684
Fix pex3 lock subset
.
#2684
Conversation
Lock subsetting could crash previously. Also fix `pex3 lock {create,sync,update} --elide-unused-requires-dist`, which would not crash, but would fail to elide some dists. Fixes pex-tool#2683
python_full_versions = ( | ||
list(iter_compatible_versions(requires_python)) if requires_python else [] | ||
) | ||
python_versions = OrderedSet( | ||
python_full_version[:2] for python_full_version in python_full_versions | ||
) | ||
|
||
os_names = [] | ||
platform_systems = [] | ||
sys_platforms = [] | ||
for target_system in target_systems: | ||
if target_system is TargetSystem.LINUX: | ||
os_names.append("posix") | ||
platform_systems.append("Linux") | ||
sys_platforms.append("linux") | ||
sys_platforms.append("linux2") | ||
elif target_system is TargetSystem.MAC: | ||
os_names.append("posix") | ||
platform_systems.append("Darwin") | ||
sys_platforms.append("darwin") | ||
elif target_system is TargetSystem.WINDOWS: | ||
os_names.append("nt") | ||
platform_systems.append("Windows") | ||
sys_platforms.append("win32") | ||
|
||
return cls( | ||
extras=frozenset(ProjectName(extra) for extra in (extras or [""])), | ||
os_names=frozenset(os_names), | ||
platform_systems=frozenset(platform_systems), | ||
sys_platforms=frozenset(sys_platforms), | ||
python_versions=frozenset( | ||
Version(".".join(map(str, python_version))) for python_version in python_versions | ||
), | ||
python_full_versions=frozenset( | ||
Version(".".join(map(str, python_full_version))) | ||
for python_full_version in python_full_versions | ||
), | ||
) |
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 expansion from extras to include os_names, platform_systems, sys_platforms, python_versions and python_full_versions plugs the holes for --style universal
locks where these markers are faked. As noted here: #2647 (comment)
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.
@huonw I just added you FYI since you reviewed the initial feature add. Although it does not appear Pants uses this yet, a Pants user has done so on their own uncovering this huge hole. I'm going to proceed with a release to get @lecardozo the fix.
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.
Thank you for the FYI! And for fixing the bugs!
Lock subsetting could crash previously. Also fix
pex3 lock {create,sync,update} --elide-unused-requires-dist
, whichwould not crash, but would fail to elide some dists.
Fixes #2683