Skip to content

Commit

Permalink
Merge 4370bdc into 734ffa9
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Arellano committed Oct 21, 2020
2 parents 734ffa9 + 4370bdc commit 233d01c
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/python/pants/python/python_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,19 @@ def register_options(cls, register):
"--interpreter-search-paths",
advanced=True,
type=list,
default=["<PEXRC>", "<PATH>"],
default=["<PYENV>", "<PATH>"],
metavar="<binary-paths>",
help="A list of paths to search for python interpreters. The following special "
"strings are supported: "
'"<PATH>" (the contents of the PATH env var), '
'"<PEXRC>" (paths in the PEX_PYTHON_PATH variable in a pexrc file), '
'"<PYENV>" (all python versions under $(pyenv root)/versions).'
'"<PYENV_LOCAL>" (the python version in BUILD_ROOT/.python-version).',
help=(
"A list of paths to search for Python interpreters that match your project's "
"interpreter constraints. You can specify absolute paths to interpreter binaries "
"and/or to directories containing interpreter binaries. The order of entries does "
"not matter. The following special strings are supported:\n\n"
'* "<PATH>", the contents of the PATH env var\n'
'* "<PYENV>", all Python versions under $(pyenv root)/versions\n'
'* "<PYENV_LOCAL>", the Pyenv interpreter with the version in '
"BUILD_ROOT/.python-version\n"
'* "<PEXRC>", paths in the PEX_PYTHON_PATH variable in /etc/pexrc or ~/.pexrc'
),
)
register(
"--resolver-manylinux",
Expand Down Expand Up @@ -310,15 +315,17 @@ def get_pyenv_paths(
pyenv_root = pyenv_root_func()
if pyenv_root is None:
return []

versions_dir = Path(pyenv_root, "versions")
if not versions_dir.is_dir():
return []

if pyenv_local:

local_version_file = Path(get_buildroot(), ".python-version")
if not local_version_file.exists():
logger.info(
logger.warning(
"No `.python-version` file found in the build root, "
"but <PYENV_LOCAL> was set in `--python-setup-interpreter-constraints`."
"but <PYENV_LOCAL> was set in `[python-setup].interpreter_search_paths`."
)
return []

Expand Down

0 comments on commit 233d01c

Please sign in to comment.