mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-22 11:31:30 +01:00
functions: update pipupdate
This commit is contained in:
parent
c91c1bfb10
commit
6211d8711c
29
functions.sh
29
functions.sh
|
@ -223,13 +223,32 @@ fi
|
||||||
|
|
||||||
### end of mac-specific functions
|
### end of mac-specific functions
|
||||||
|
|
||||||
function pipupdate(){
|
pipupdate(){
|
||||||
for pip in pip2 pip3; do
|
set -x
|
||||||
if [ -z $pip ]; then
|
if [[ "$1" == "user" ]]; then
|
||||||
continue
|
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
|
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
|
done
|
||||||
|
set +x
|
||||||
}
|
}
|
||||||
|
|
||||||
# unzip file to directory with the same name of the zip file (without extension)
|
# unzip file to directory with the same name of the zip file (without extension)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user