Skip to content

Commit f5fb293

Browse files
committed
Clarify how src/tools/x searches for python
1 parent 11909e3 commit f5fb293

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/tools/x/src/main.rs

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ fn python() -> &'static str {
2626
let mut python3 = false;
2727

2828
for dir in env::split_paths(&val) {
29+
// `python` should always take precedence over python2 / python3 if it exists
2930
if dir.join(PYTHON).exists() {
3031
return PYTHON;
3132
}
@@ -34,11 +35,14 @@ fn python() -> &'static str {
3435
python3 |= dir.join(PYTHON3).exists();
3536
}
3637

38+
// try 3 before 2
3739
if python3 {
3840
PYTHON3
3941
} else if python2 {
4042
PYTHON2
4143
} else {
44+
// We would have returned early if we found that python is installed ...
45+
// maybe this should panic with an error instead?
4246
PYTHON
4347
}
4448
}

0 commit comments

Comments
 (0)