Skip to content

Commit 0c5a086

Browse files
committed
clean up handling of find_python3
1 parent a7d7ff1 commit 0c5a086

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

.evergreen/utils.sh

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,29 @@ set -eu
44

55
find_python3() {
66
PYTHON=""
7-
# Add a fallback system python3 if it is available and Python 3.9+.
8-
if is_python_39 "$(command -v python3)"; then
9-
PYTHON="$(command -v python3)"
10-
fi
117
# Find a suitable toolchain version, if available.
128
if [ "$(uname -s)" = "Darwin" ]; then
13-
# macos 11.00
14-
if [ -d "/Library/Frameworks/Python.Framework/Versions/3.10" ]; then
15-
PYTHON="/Library/Frameworks/Python.Framework/Versions/3.10/bin/python3"
16-
# macos 10.14
17-
elif [ -d "/Library/Frameworks/Python.Framework/Versions/3.9" ]; then
18-
PYTHON="/Library/Frameworks/Python.Framework/Versions/3.9/bin/python3"
19-
fi
9+
PYTHON="/Library/Frameworks/Python.Framework/Versions/Current/bin/python3"
2010
elif [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin
21-
PYTHON="C:/python/Python39/python.exe"
11+
PYTHON="C:/python/Current/python.exe"
2212
else
2313
# Prefer our own toolchain, fall back to mongodb toolchain if it has Python 3.9+.
24-
if [ -f "/opt/python/3.9/bin/python3" ]; then
25-
PYTHON="/opt/python/3.9/bin/python3"
14+
if [ -f "/opt/python/Current/bin/python3" ]; then
15+
PYTHON="/opt/python/Current/bin/python3"
16+
elif is_python_39 "$(command -v /opt/mongodbtoolchain/v5/bin/python3)"; then
17+
PYTHON="/opt/mongodbtoolchain/v5/bin/python3"
2618
elif is_python_39 "$(command -v /opt/mongodbtoolchain/v4/bin/python3)"; then
2719
PYTHON="/opt/mongodbtoolchain/v4/bin/python3"
2820
elif is_python_39 "$(command -v /opt/mongodbtoolchain/v3/bin/python3)"; then
2921
PYTHON="/opt/mongodbtoolchain/v3/bin/python3"
3022
fi
3123
fi
24+
# Add a fallback system python3 if it is available and Python 3.9+.
25+
if [ -z "$PYTHON" ]; then
26+
if is_python_39 "$(command -v python3)"; then
27+
PYTHON="$(command -v python3)"
28+
fi
29+
fi
3230
if [ -z "$PYTHON" ]; then
3331
echo "Cannot test without python3.9+ installed!"
3432
exit 1

0 commit comments

Comments
 (0)