Skip to content

Commit

Permalink
make a somewhat-reasonable command line work that didn't before
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Sep 28, 2020
1 parent 2fc5078 commit ca80d0d
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions pex/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,13 +978,26 @@ def iter_targets():
# Build for the specified local interpreters (on the current platform).
yield DistributionTarget.for_interpreter(interpreter)

def check_platform_against_interpreters(platform):
if platform is not None:
# 1. Build for specific platforms, if not already matched by some interpreter.
if interpreters:
for interpreter in interpreters:
if platform == interpreter.platform:
break
else:
yield DistributionTarget.for_platform(platform)
else:
yield DistributionTarget.for_platform(platform)
elif not interpreters:
# 2. Build for the current platform (None) only if not done already (ie: no
# interpreters were specified).
yield DistributionTarget.for_platform(platform)

if parsed_platforms:
for platform in parsed_platforms:
if platform is not None or not interpreters:
# 1. Build for specific platforms.
# 2. Build for the current platform (None) only if not done already (ie: no intepreters
# were specified).
yield DistributionTarget.for_platform(platform)
for target in check_platform_against_interpreters(platform):
yield target

# Only download for each target once. The download code assumes this unique targets optimization
# when spawning parallel downloads.
Expand Down

0 comments on commit ca80d0d

Please sign in to comment.