Skip to content

Commit c4515b0

Browse files
committed
Fix reported issues w.r.t python2.7 and some apple silicone quirks
1 parent 67548a3 commit c4515b0

File tree

1 file changed

+46
-31
lines changed

1 file changed

+46
-31
lines changed

tools/extras/check_dependencies.sh

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -82,61 +82,73 @@ if ! have libtoolize && ! have glibtoolize; then
8282
add_packages libtool
8383
fi
8484

85-
if ! have svn; then
86-
echo "$0: subversion is not installed"
87-
add_packages subversion
88-
fi
89-
9085
if ! have awk; then
9186
echo "$0: awk is not installed"
9287
add_packages gawk
9388
fi
9489

95-
pythonok=true
90+
pythonok=false
91+
python3=false
92+
python27=false
93+
94+
9695
if ! have python2.7; then
9796
echo "$0: python2.7 is not installed"
98-
add_packages python27 python2.7
99-
pythonok=false
97+
else
98+
echo "$0: python2.7 present"
99+
python27=true
100+
pythonok=true
100101
fi
101102

102103
if ! have python3; then
103104
echo "$0: python3 is not installed"
104105
add_packages python3
105-
pythonok=false
106+
else
107+
echo "$0: python3 present"
108+
python3=true
109+
pythonok=true
106110
fi
107111

108112
(
109113
#Use a subshell so that sourcing env.sh does not have an influence on the rest of the script
110114
[ -f ./env.sh ] && . ./env.sh
111-
if $pythonok && ! have python2; then
112-
mkdir -p $PWD/python
113-
echo "$0: python2.7 is installed, but the python2 binary does not exist." \
114-
"Creating a symlink and adding this to tools/env.sh"
115-
ln -s $(command -v python2.7) $PWD/python/python2
116-
echo "export PATH=$PWD/python:\${PATH}" >> env.sh
117-
fi
118-
119-
if [[ -f $PWD/python/.use_default_python && -f $PWD/python/python ]]; then
120-
rm $PWD/python/python
121-
fi
122-
123-
if $pythonok && have python && [[ ! -f $PWD/python/.use_default_python ]]; then
124-
version=$(python 2>&1 --version | awk '{print $2}')
125-
if [[ $version != "2.7"* ]] ; then
126-
echo "$0: WARNING python 2.7 is not the default python. We fixed this by" \
127-
"adding a correct symlink more prominently on the path."
128-
echo " ... If you really want to use python $version as default, add an" \
115+
rm -f $PWD/python/python*
116+
if ! [ -f $PWD/python/.use_default_python ]; then
117+
echo "$0: Configuring python"
118+
echo "$0: ... If you really want to avoid this, add an" \
129119
"empty file $PWD/python/.use_default_python and run this script again."
130-
mkdir -p $PWD/python
120+
if $python27 ; then
121+
echo "$0: ... python2.7 found, making it default (python, python2, python2.7)"
131122
ln -s $(command -v python2.7) $PWD/python/python
132-
echo "export PATH=$PWD/python:\${PATH}" >> env.sh
123+
ln -s $(command -v python2.7) $PWD/python/python2
124+
ln -s $(command -v python2.7) $PWD/python/python2.7
125+
fi
126+
127+
if $python3 ; then
128+
echo "$0: ... python3 found, making symlink (python3)"
129+
ln -s $(command -v python3) $PWD/python/python3
130+
if ! $python27 ; then
131+
echo "$0: ... ... python2.7 not found, using python3 as python"
132+
ln -s $(command -v python3) $PWD/python/python
133+
fi
134+
fi
135+
else
136+
echo "$0: Not configuring python(s) -- using system defaults"
137+
if ! have python ; then
138+
echo "$0: WARNING: 'python' executable not present, configuring"
139+
if $python27 ; then
140+
ln -s $(command -v python2.7) $PWD/python/python
141+
elif $python3 ; then
142+
ln -s $(command -v python3) $PWD/python/python
143+
fi
133144
fi
134145
fi
146+
135147
)
136148

137149
mathlib_missing=false
138-
case $(uname -m) in
139-
x86_64) # Suggest MKL on an Intel64 system (not supported on i?86 hosts).
150+
case "$(uname -m)-$(uname -s)" in
151+
x86_64*) # Suggest MKL on an Intel64 system (not supported on i?86 hosts).
140152
# Respect user-supplied MKL_ROOT environment variable.
141153
MKL_ROOT="${MKL_ROOT:-/opt/intel/mkl}"
142154
# Check the well-known mkl.h file location.
@@ -155,6 +167,9 @@ case $(uname -m) in
155167
mathlib_missing=true
156168
fi
157169
;;
170+
arm64-Darwin) ## Apple Silicon
171+
echo "$0: Relying on Acceleration framework"
172+
;;
158173
*) # Suggest OpenBLAS on other hardware.
159174
if [ ! -f $(pwd)/OpenBLAS/install/include/openblas_config.h ] &&
160175
! echo '#include <openblas_config.h>' |

0 commit comments

Comments
 (0)