refactor: fix python version issue and add upgrade deps
This commit is contained in:
parent
1e7996817a
commit
a9c928e39f
20
bin/app
20
bin/app
@ -5,7 +5,13 @@ _activate_venv() {
|
|||||||
. .venv/bin/activate
|
. .venv/bin/activate
|
||||||
}
|
}
|
||||||
|
|
||||||
_venv() {
|
_upgrade_deps() {
|
||||||
|
_activate_venv
|
||||||
|
echo $(cat requirements.txt | sed 's/==.*//g') | xargs pip install -U
|
||||||
|
}
|
||||||
|
UPGRADE_DEPS_match=upgrade-deps
|
||||||
|
|
||||||
|
venv() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"") _skip=false ;;
|
"") _skip=false ;;
|
||||||
--skip-install)
|
--skip-install)
|
||||||
@ -15,18 +21,11 @@ _venv() {
|
|||||||
*) _skip=false ;;
|
*) _skip=false ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if ! $_skip; then
|
|
||||||
_py_version=${1:-3.12.0}
|
_py_version=${1:-3.12.0}
|
||||||
|
if ! $_skip; then
|
||||||
pyenv install $_py_version
|
pyenv install $_py_version
|
||||||
|
|
||||||
#init pyenv
|
|
||||||
export PYENV_ROOT="$HOME/.pyenv"
|
|
||||||
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
|
||||||
eval "$(pyenv init -)"
|
|
||||||
|
|
||||||
pyenv shell $_py_version
|
|
||||||
fi
|
fi
|
||||||
|
pyenv local $_py_version
|
||||||
|
|
||||||
if [ -d .venv ]; then
|
if [ -d .venv ]; then
|
||||||
rm -rf .venv
|
rm -rf .venv
|
||||||
@ -116,6 +115,7 @@ _main() {
|
|||||||
_init
|
_init
|
||||||
;;
|
;;
|
||||||
"$FREEZE_match") _freeze ;;
|
"$FREEZE_match") _freeze ;;
|
||||||
|
"$UPGRADE_DEPS_match") _upgrade_deps ;;
|
||||||
--*) ;;
|
--*) ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user