Skip to content

Commit 99c2e54

Browse files
author
Jack Desert
committed
Fail if Specified Interpreter Not Found
(Do NOT use basepython as a fallback) This is intended to remedy these two github issues: tox-dev#882 tox-dev#1484 by :user: jackdesert
1 parent ffb4975 commit 99c2e54

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

CONTRIBUTORS

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Igor Duarte Cardoso
4646
Ilya Kulakov
4747
Ionel Maries Cristian
4848
Itxaka Serrano
49+
Jack Desert
4950
Jake Windle
5051
Jannis Leidel
5152
Jesse Schwartzentruber

src/tox/interpreters/unix.py

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import unicode_literals
2+
import sys
23

34
import tox
45

@@ -8,12 +9,15 @@
89

910
@tox.hookimpl
1011
def tox_get_python_executable(envconfig):
12+
"""
13+
Return path to specified interpreter.
14+
If not available, exit(1).
15+
"""
1116
spec, path = base_discover(envconfig)
12-
if path is not None:
17+
18+
if path is None:
19+
print('envname {} not found'.format(envconfig.envname))
20+
sys.exit(1)
21+
else:
1322
return path
14-
# 3. check if the literal base python
15-
candidates = [envconfig.basepython]
16-
# 4. check if the un-versioned name is good
17-
if spec.name is not None and spec.name != envconfig.basepython:
18-
candidates.append(spec.name)
19-
return check_with_path(candidates, spec)
23+
~

0 commit comments

Comments
 (0)