d7f2c00d7b
- Migration 007: repo_url on apps table + analysis table with FTS5 - Analysis struct, parser, CRUD, validation, hash computation - Selective purge: remote-only apps/analysis preserved across fn index - CLI: fn app list/clone/pull, fn analysis list/clone/pull - search/show/list now include analysis results - Apps removed from git tracking (content lives in Gitea repos) - .gitkeep for apps/ and analysis/ dirs - Bash functions: jupyter analysis pipeline, shell utilities - Browser domain: CDP functions moved from infra to browser Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
36 lines
928 B
Bash
36 lines
928 B
Bash
# init_uv_venv
|
|
# -------------
|
|
# Crea un venv con uv en el directorio especificado si no existe.
|
|
# Fallback a python -m venv si uv no esta disponible.
|
|
# Imprime la ruta del venv a stdout.
|
|
#
|
|
# USO (sourced):
|
|
# source init_uv_venv.sh
|
|
# venv_path=$(init_uv_venv /path/to/project)
|
|
|
|
init_uv_venv() {
|
|
local project_dir="${1:-.}"
|
|
local venv_path="${project_dir}/.venv"
|
|
|
|
if [ -d "$venv_path" ] && [ -f "$venv_path/bin/python" ]; then
|
|
echo "$venv_path"
|
|
return 0
|
|
fi
|
|
|
|
if command -v uv &>/dev/null; then
|
|
(cd "$project_dir" && uv venv) >/dev/null 2>&1
|
|
elif command -v python3 &>/dev/null; then
|
|
python3 -m venv "$venv_path"
|
|
else
|
|
echo "init_uv_venv: ni uv ni python3 disponibles" >&2
|
|
return 1
|
|
fi
|
|
|
|
if [ ! -f "$venv_path/bin/python" ]; then
|
|
echo "init_uv_venv: fallo al crear venv en $venv_path" >&2
|
|
return 1
|
|
fi
|
|
|
|
echo "$venv_path"
|
|
}
|