forked from binpash/pash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-pash.sh
executable file
·71 lines (57 loc) · 2.13 KB
/
setup-pash.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
set -e
## TODO: Maybe hide stdout and stderr to logs by default and only if debug flag exists show
cd "$(dirname "$0")"
# set PASH_TOP
PASH_TOP=${PASH_TOP:-$(git rev-parse --show-toplevel)}
cd $PASH_TOP
. "$PASH_TOP/scripts/utils.sh"
read_cmd_args $@
LOG_DIR=$PASH_TOP/install_logs
mkdir -p $LOG_DIR
PYTHON_PKG_DIR=$PASH_TOP/python_pkgs
# remove the folder in case it exists
rm -rf $PYTHON_PKG_DIR
# create the new folder
mkdir -p $PYTHON_PKG_DIR
echo "Installing python dependencies..."
python3 -m pip install -r "$PASH_TOP/requirements.txt" --no-cache-dir --root $PYTHON_PKG_DIR --ignore-installed
## numpy and matplotlib are only needed to generate the evaluation plots so they should not be in the main path
if [[ "$install_eval" == 1 ]]; then
python3 -m pip install numpy --root $PYTHON_PKG_DIR --ignore-installed #&> $LOG_DIR/pip_install_numpy.log
python3 -m pip install matplotlib --root $PYTHON_PKG_DIR --ignore-installed #&> $LOG_DIR/pip_install_matplotlib.log
fi
# clean the python packages
cd $PYTHON_PKG_DIR
# can we find a better alternative to that
pkg_path=$(find . \( -name "site-packages" -or -name "dist-packages" \) -type d)
for directory in $pkg_path; do
# using which to avoid the `-i` alias in many distros
$(which cp) -r $directory/* ${PYTHON_PKG_DIR}/
done
# Build runtime tools: eager, split
echo "Building runtime tools..."
cd "$PASH_TOP/runtime/"
case "$distro" in
freebsd*)
gmake #&> $LOG_DIR/make.log
;;
*)
make #&> $LOG_DIR/make.log
if [ -f /.dockerenv ]; then
# issue with docker only
python3 -m pip install -U --force-reinstall pip
cp "$PASH_TOP"/pa.sh /usr/bin/
fi
;;
esac
echo "Generating input files..."
$PASH_TOP/evaluation/tests/input/setup.sh
# export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/"
echo " * * * "
echo "Do not forget to export PASH_TOP before using pash: \`export PASH_TOP=$PASH_TOP\`"
echo " * * * "
# in case we are running on docker or CI, installation is complete at this moment
if [[ -f /.dockerenv || -f /.githubenv ]]; then
exit 0
fi