@@ -4,31 +4,29 @@ set -eu
4
4
5
5
find_python3 () {
6
6
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
11
7
# Find a suitable toolchain version, if available.
12
8
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"
20
10
elif [ " Windows_NT" = " ${OS:- } " ]; then # Magic variable in cygwin
21
- PYTHON=" C:/python/Python39 /python.exe"
11
+ PYTHON=" C:/python/Current /python.exe"
22
12
else
23
13
# 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"
26
18
elif is_python_39 " $( command -v /opt/mongodbtoolchain/v4/bin/python3) " ; then
27
19
PYTHON=" /opt/mongodbtoolchain/v4/bin/python3"
28
20
elif is_python_39 " $( command -v /opt/mongodbtoolchain/v3/bin/python3) " ; then
29
21
PYTHON=" /opt/mongodbtoolchain/v3/bin/python3"
30
22
fi
31
23
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
32
30
if [ -z " $PYTHON " ]; then
33
31
echo " Cannot test without python3.9+ installed!"
34
32
exit 1
0 commit comments