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() {
|
||||
_upgrade_deps() {
|
||||
_activate_venv
|
||||
echo $(cat requirements.txt | sed 's/==.*//g') | xargs pip install -U
|
||||
}
|
||||
UPGRADE_DEPS_match=upgrade-deps
|
||||
|
||||
venv() {
|
||||
case "$1" in
|
||||
"") _skip=false ;;
|
||||
--skip-install)
|
||||
@ -15,18 +21,11 @@ _venv() {
|
||||
*) _skip=false ;;
|
||||
esac
|
||||
|
||||
_py_version=${1:-3.12.0}
|
||||
if ! $_skip; then
|
||||
_py_version=${1:-3.12.0}
|
||||
|
||||
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
|
||||
pyenv local $_py_version
|
||||
|
||||
if [ -d .venv ]; then
|
||||
rm -rf .venv
|
||||
@ -116,6 +115,7 @@ _main() {
|
||||
_init
|
||||
;;
|
||||
"$FREEZE_match") _freeze ;;
|
||||
"$UPGRADE_DEPS_match") _upgrade_deps ;;
|
||||
--*) ;;
|
||||
esac
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user