Skip to content

Commit

Permalink
Fix resolve regressions introduced by the 1.4.8.
Browse files Browse the repository at this point in the history
PR pex-tool#571 regressed the half-broken state of having
`--interpreter_constraint` selected interpreters not setup to also
having `--python` selected interpreters also not setup. In addition,
PR pex-tool#568 incorrectly classified the current Platform passed by
`resolve_multi` as a user-specified extended platform specification
breaking custom interpreter resolution. Fix both and add tests that
failed prior to this combination of fixes.

A more comprehensive fix is tracked in part by pex-tool#579.
  • Loading branch information
jsirois committed Oct 8, 2018
1 parent 28bf694 commit e6dc6d0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pex/bin/pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ def walk_and_do(fn, src_dir):
with TRACER.timed('Resolving distributions'):
try:
resolveds = resolve_multi(resolvables,
interpreters=interpreters,
interpreters=setup_interpreters,
platforms=options.platforms,
cache=options.cache_dir,
cache_ttl=options.cache_ttl,
Expand Down
2 changes: 1 addition & 1 deletion pex/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ def resolve_multi(requirements,
"""

interpreters = interpreters or [PythonInterpreter.get()]
platforms = platforms or [Platform.current()]
platforms = platforms or ['current']

seen = set()
for interpreter in interpreters:
Expand Down
25 changes: 25 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,3 +1076,28 @@ def test_pex_interpreter_interact_custom_setuptools_useable():
env=make_env(PEX_VERBOSE=1),
stdin=test_script)
assert rc == 0, stdout


def test_setup_python():
interpreter = ensure_python_interpreter(PY27)
with temporary_dir() as out:
pex = os.path.join(out, 'pex.pex')
results = run_pex_command(['jsonschema==2.6.0',
'--disable-cache',
'--python={}'.format(interpreter),
'-o', pex])
results.assert_success()
subprocess.check_call([pex, '-c', 'import jsonschema'])


def test_setup_interpreter_constraint():
interpreter = ensure_python_interpreter(PY27)
with temporary_dir() as out:
pex = os.path.join(out, 'pex.pex')
with environment_as(PATH=os.path.dirname(interpreter)):
results = run_pex_command(['jsonschema==2.6.0',
'--disable-cache',
'--interpreter-constraint=CPython=={}'.format(PY27),
'-o', pex])
results.assert_success()
subprocess.check_call([pex, '-c', 'import jsonschema'])

0 comments on commit e6dc6d0

Please sign in to comment.