forked from os2datascanner/os2datascanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·56 lines (43 loc) · 1.53 KB
/
install.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
#!/usr/bin/env bash
set -e
failure() {
echo "$0: installation failed"
}
trap failure ERR
DIR="$(dirname "${BASH_SOURCE[0]}")"
VIRTUALENV="$DIR/python-env"
install_system_dependencies() {
# System dependencies. These are the packages we need that are not present
# on a fresh Ubuntu install.
echo "$0: installing system dependencies"
SYSTEM_PACKAGES=$(cat "$DIR/requirements/system_dependencies.txt")
sudo -H apt-get update
for package in ${SYSTEM_PACKAGES[@]}
do
sudo -H apt-get -y install "$package" || return 1
done
}
install_python_environment() {
# Setup virtualenv, install Python packages necessary to run BibOS Admin.
echo "$0: installing Python environment and dependencies"
if [ -e "$VIRTUALENV/bin/python3" ]
then
echo "$0: Python environment already installed" 1>&2
else
python3 -m venv --system-site-packages "$VIRTUALENV"
fi &&
"$VIRTUALENV/bin/pip" install -U setuptools wheel pip &&
"$VIRTUALENV/bin/pip" install -r "$DIR/requirements/requirements.txt"
}
configure_development_environment() {
echo "$0: configuring development environment"
# setup.py develop seems to assume that the current working directory is
# the thing that should be copied into python-env, which can mean copying
# references to files to which (say) a web server user has no access. Argh!
pushd "$DIR"
"$VIRTUALENV/bin/python" "$DIR/setup.py" develop
popd
}
install_system_dependencies
install_python_environment
configure_development_environment