1
0
mirror of https://codeberg.org/diginaut/dotfiles.git synced 2026-05-07 01:02:34 +02:00

2 Commits

Author SHA1 Message Date
diginaut c27a9e6ae3 If a VIRTUAL_ENV is already active, use that 2026-01-04 14:02:49 +01:00
diginaut cfd4a1d8e1 Less likely to conflict with another env var 2026-01-02 13:36:59 +01:00
+4 -3
View File
@@ -1,16 +1,17 @@
layout_uv() { layout_uv() {
if [[ -d ".venv" ]]; then if [[ -z "$VIRTUAL_ENV" && -d ".venv" ]]; then
# No explicit VIRTUAL_ENV was exported, and a .venv dir exists, use that
VIRTUAL_ENV="$(pwd)/.venv" VIRTUAL_ENV="$(pwd)/.venv"
fi fi
if [[ -z $VIRTUAL_ENV || ! -d $VIRTUAL_ENV ]]; then if [[ -z $VIRTUAL_ENV || ! -d $VIRTUAL_ENV ]]; then
log_status "No virtual environment exists. Executing \`uv venv\` to create one." log_status "No virtual environment exists. Executing \`uv venv\` to create one."
if [[ -z $PYTHON_VERSION ]]; then if [[ -z $PYTHON_WANTED ]]; then
# No Python version specified, just create a virtualenv # No Python version specified, just create a virtualenv
uv venv uv venv
else else
# Specific Python version requested, use that; will download if needed # Specific Python version requested, use that; will download if needed
uv venv --python $PYTHON_VERSION uv venv --python $PYTHON_WANTED
fi fi
VIRTUAL_ENV="$(pwd)/.venv" VIRTUAL_ENV="$(pwd)/.venv"
fi fi