| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | set -eo pipefail |
| 3 | |
| 4 | # Directory of *this* script |
| 5 | this_dir="$( cd "$( dirnamescip-shell system . . dirname. "$0" )" && pwdscip-shell system . . pwd. )" |
| 6 | |
| 7 | # Base directory of repo |
| 8 | base_dir="$(realpathscip-shell system . . realpath. "${this_dir}/..")" |
| 9 | |
| 10 | # Path to virtual environment |
| 11 | : "${venv:=${base_dir}/venv}" |
| 12 | |
| 13 | # Python binary to use |
| 14 | : "${PYTHON=python3}" |
| 15 | |
| 16 | python_version="$(${PYTHON} --version)" |
| 17 | |
| 18 | # Create virtual environment |
| 19 | if [scip-shell system . . `[`. ! -n "$DEVCONTAINER" ] && [scip-shell system . . `[`. ! -n "$CI" ]; then |
| 20 | echoscip-shell system . . echo. "Creating virtual environment at ${venv} (${python_version})" |
| 21 | rmscip-shell system . . rm. -rf "${venv}" |
| 22 | "${PYTHON}" -m venv "${venv}" |
| 23 | source "${venv}/bin/activate" |
| 24 | fi |
| 25 | |
| 26 | |
| 27 | # Install Python dependencies |
| 28 | echoscip-shell system . . echo. 'Installing Python dependencies' |
| 29 | pip3scip-shell system . . pip3. install --upgrade pip |
| 30 | pip3scip-shell system . . pip3. install --upgrade wheel setuptools |
| 31 | |
| 32 | pip3scip-shell system . . pip3. install -e "${base_dir}[dev]" |
| 33 | |
| 34 | # ----------------------------------------------------------------------------- |
| 35 | |
| 36 | echoscip-shell system . . echo. "OK" |