cringethon
This commit is contained in:
parent
ea0f707516
commit
ca7419c377
5 changed files with 12 additions and 26 deletions
|
|
@ -1,23 +0,0 @@
|
|||
layout_python_uv() {
|
||||
local python=${1:-python}
|
||||
[[ $# -gt 0 ]] && shift
|
||||
unset PYTHONHOME
|
||||
local python_version=$($python -V | cut -d " " -f 2 | cut -d . -f 1-2)
|
||||
if [[ -z $python_version ]]; then
|
||||
log_error "Could not find python's version"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ -n "${VIRTUAL_ENV:-}" ]]; then
|
||||
local REPLY
|
||||
realpath.absolute "$VIRTUAL_ENV"
|
||||
VIRTUAL_ENV=$REPLY
|
||||
else
|
||||
VIRTUAL_ENV=$(direnv_layout_dir)/python-$python_version
|
||||
fi
|
||||
if [[ ! -d $VIRTUAL_ENV ]]; then
|
||||
uv venv -p $python "$@" "$VIRTUAL_ENV"
|
||||
fi
|
||||
export VIRTUAL_ENV
|
||||
PATH_add "$VIRTUAL_ENV/bin"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue