forked from cloudfoundry/python-buildpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils
More file actions
executable file
·56 lines (46 loc) · 1.05 KB
/
Copy pathutils
File metadata and controls
executable file
·56 lines (46 loc) · 1.05 KB
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
shopt -s extglob
if [ $(uname) == Darwin ]; then
sed() { command sed -l "$@"; }
else
sed() { command sed -u "$@"; }
fi
# Syntax sugar.
indent() {
sed "s/^/ /"
}
# Clean up pip output
cleanup() {
sed -e 's/\.\.\.\+/.../g' | sed -e '/already satisfied/Id' | sed -e '/No files were found to uninstall/Id' | sed -e '/Overwriting/Id' | sed -e '/python executable/Id' | sed -e '/no previously-included files/Id'
}
# Buildpack Indented line.
puts-line() {
echo " $@"
}
# Buildpack Steps.
puts-step() {
echo "-----> $@"
}
# Buildpack Warnings.
puts-warn() {
echo " ! $@"
}
# Buildpack Commands.
puts-cmd() {
echo " $ $@"
}
set-env-prepend () {
env_name=$1
env_val=$2
if [[ -z "${!env_name:-}" ]]; then
export "$env_name"=$env_val
else
export "$env_name"=$env_val:"${!env_name}"
fi
}
append_profile_d() {
echo "export $1=$2" >> $DEPS_DIR/$DEPS_IDX/profile.d/python.supply.sh
}
# Usage: $ set_default_profile_d key value
set_default_profile_d() {
echo "export $1=\${$1:-$2}" >> $DEPS_DIR/$DEPS_IDX/python.supply.sh
}