forked from hacl-star/hacl-star
-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_scons.sh
executable file
·32 lines (26 loc) · 880 Bytes
/
run_scons.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
# Platform-independent invocation of SCons
# Inspired from the Everest script
set -e
SCONS_PYTHON_MAJOR_MINOR=3.6
# Windows-only: print out the directory of the Python associated to SCons
windows_scons_python_dir () {
PYDIR=$(regtool -q get "/HKLM/Software/Python/PythonCore/$SCONS_PYTHON_MAJOR_MINOR/InstallPath/" || true)
if ! [[ -d $PYDIR ]] ; then
PYDIR=$(regtool -q get "/HKCU/Software/Python/PythonCore/$SCONS_PYTHON_MAJOR_MINOR/InstallPath/" || true)
fi
if ! [[ -d $PYDIR ]] ; then
red "ERROR: Python $SCONS_PYTHON_MAJOR_MINOR was not installed properly"
exit 1
fi
echo "$PYDIR"
}
is_windows () {
[[ $OS == "Windows_NT" ]]
}
if is_windows ; then
pydir=$(windows_scons_python_dir)
"$pydir/python.exe" "$pydir/Scripts/scons.py" "$@"
else
python$SCONS_PYTHON_MAJOR_MINOR $(which scons) "$@"
fi