forked from Checkmk/checkmk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-pipenv
executable file
·37 lines (33 loc) · 1.32 KB
/
run-pipenv
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
#!/bin/bash
# Copyright (C) 2022 Checkmk GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.
set -e
run_pipenv() {
PIPENV_CACHE_DIR="$(pwd)/.cache" \
PIPENV_VENV_IN_PROJECT=true \
PIPENV_NOSPIN=true \
PIPENV_HIDE_EMOJIS=true \
PIPENV_NO_INHERIT=true \
PIPENV_PIPFILE="$(pwd)/Pipfile" \
PIPENV_IGNORE_VIRTUALENVS=1 \
pipenv "$@"
}
setup_venv() {
test "${SETUP_VENV_RAN}" = "yes" && return
# --quiet doesn't really work, see https://github.com/pypa/pipenv/issues/5037, but redirecting
# stdout is OK, errors go to stderr, and so do the initial venv creation messages.
run_pipenv sync --dev >/dev/null
run_pipenv clean
# poor man's "activate", but without any danger of naming clashes
PATH="$(pwd)/.venv/bin:$PATH"
hash -r
SETUP_VENV_RAN=yes
}
# Change to the directory where this script resides, it makes many things easier
# and we can call this script from everywhere.
cd -- "${BASH_SOURCE%/*}"
setup_venv
# This run script is atm *ONLY* used for providing a stripped down .venv for the distro package build
# in order to separate it from the huge global .venv and therefore improve runtimes.
run_pipenv "$@"