extract utils

This commit is contained in:
Kenneth Reitz
2012-12-03 16:00:23 +01:00
parent 863abfb00e
commit ecf5278679
3 changed files with 37 additions and 36 deletions
+1 -35
View File
@@ -66,41 +66,7 @@ unset GIT_DIR PYTHONHOME PYTHONPATH LD_LIBRARY_PATH LIBRARY_PATH
# We'll need to send these statics to other scripts we `source`.
export PIP_DOWNLOAD_CACHE BUILD_DIR CACHE_DIR BIN_DIR PROFILE_PATH
# Syntax sugar.
indent() {
RE="s/^/ /"
[ $(uname) == "Darwin" ] && sed -l "$RE" || sed -u "$RE"
}
# Clean up pip output
cleanup() {
sed -e 's/\.\.\.\+/.../g' | sed -e '/already satisfied/Id' | sed -e '/Overwriting/Id' | sed -e '/python executable/Id' | sed -e '/no previously-included files/Id'
}
# Virtualenv wrapper.
function virtualenv (){
python "$ROOT_DIR/vendor/virtualenv-1.8.4/virtualenv.py" "$@"
}
# Buildpack Steps.
function puts-step (){
echo "-----> $@"
}
# Buildpack Warnings.
function puts-warn (){
echo " ! $@"
}
# Usage: $ set-env key value
function set-env (){
echo "export $1=$2" >> $PROFILE_PATH
}
# Usage: $ set-default-env key value
function set-default-env (){
echo "export $1=\${$1:-$2}" >> $PROFILE_PATH
}
source $BIN_DIR/utils
# ## Build Time
#
+1 -1
View File
@@ -61,4 +61,4 @@ IFS_BAK=
SETTINGS_FILE=$(find $BUILD_DIR/. -maxdepth 2 -type f -name 'settings.py' | head -1)
[ -n "$SETTINGS_FILE" ] && ( list_requirements $BUILD_DIR/requirements.txt | grep -Fiq "django" ) && echo Python/Django || echo Python
[ -n "$SETTINGS_FILE" ] && ( list_requirements $BUILD_DIR/requirements.txt | grep -Fiq "django" ) && echo Python/Django || echo Python
Executable
+35
View File
@@ -0,0 +1,35 @@
# Syntax sugar.
indent() {
RE="s/^/ /"
[ $(uname) == "Darwin" ] && sed -l "$RE" || sed -u "$RE"
}
# Clean up pip output
cleanup() {
sed -e 's/\.\.\.\+/.../g' | sed -e '/already satisfied/Id' | sed -e '/Overwriting/Id' | sed -e '/python executable/Id' | sed -e '/no previously-included files/Id'
}
# Virtualenv wrapper.
function virtualenv (){
python "$ROOT_DIR/vendor/virtualenv-1.8.4/virtualenv.py" "$@"
}
# Buildpack Steps.
function puts-step (){
echo "-----> $@"
}
# Buildpack Warnings.
function puts-warn (){
echo " ! $@"
}
# Usage: $ set-env key value
function set-env (){
echo "export $1=$2" >> $PROFILE_PATH
}
# Usage: $ set-default-env key value
function set-default-env (){
echo "export $1=\${$1:-$2}" >> $PROFILE_PATH
}