summaryrefslogtreecommitdiffstats
path: root/setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'setup.sh')
-rwxr-xr-xsetup.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/setup.sh b/setup.sh
new file mode 100755
index 0000000..cf1d366
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# @author: <sylvain.herledan@hrafnagud.info>
+# @date: 2017-06-06
+
+set -o nounset
+set -o errexit
+set -o pipefail
+
+readonly PROGNAME="$(basename "${0}")";
+readonly PROGDIR="$(readlink -f "$(dirname "${0}")")";
+readonly ARGS="${@}";
+
+install_virtualenv()
+{
+ local install_dir="${1}"; shift;
+ local install_script_path="$(mktemp)";
+ local env_dir="${install_dir}/env";
+
+ wget 'https://bootstrap.pypa.io/get-pip.py' -O "${install_script_path}"
+ mkdir -p "${env_dir}"
+
+ PYTHONUSERBASE="${env_dir}" python "${install_script_path}" --user
+ rm -f "${install_script_path}"
+
+ PYTHONUSERBASE="${env_dir}" "${env_dir}/bin/pip" install --user virtualenv
+
+ local python_pkg_dir="$(find "${env_dir}/lib" -type d -name "*-packages" | head -1)";
+ PYTHONPATH="${python_pkg_dir}" env/bin/virtualenv env
+}
+
+install_virtualenv ${ARGS}
+exit 0