functions: update pipupdate

feature/symbol-search
bretello 2020-11-13 13:26:19 +01:00
parent c91c1bfb10
commit 6211d8711c
1 changed files with 24 additions and 5 deletions

View File

@ -223,13 +223,32 @@ fi
### end of mac-specific functions
function pipupdate(){
for pip in pip2 pip3; do
if [ -z $pip ]; then
continue
pipupdate(){
set -x
if [[ "$1" == "user" ]]; then
user_flags='--user'
shift
fi
if [[ -n "$@" ]]; then
pip="$1"
shift
flags="$*"
echo "pip command is: '$pip $flags'"
if ! command -v "$pip" ; then
echo "Given command ($1) does not exist." 1>&2
return
fi
$pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 $pip install -U
else
pip='python'
flags='-m pip'
echo "Using default pip: $pip $flags"
fi
for package in $($pip $flags freeze $user_flags --local | grep -v '^\-e' | cut -d = -f 1) ; do
$pip $flags install "$user_flags" -U "$package"
done
set +x
}
# unzip file to directory with the same name of the zip file (without extension)