mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
fix bootstrap
This commit is contained in:
parent
c6eed9329b
commit
6d4669c8e7
2 changed files with 17 additions and 5 deletions
|
|
@ -10,16 +10,18 @@ echo "==> Updating system packages..."
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get upgrade -y
|
sudo apt-get upgrade -y
|
||||||
|
|
||||||
rm -rf .venv/
|
|
||||||
|
|
||||||
echo "==> Checking for uv..."
|
echo "==> Checking for uv..."
|
||||||
if ! command -v uv >/dev/null 2>&1; then
|
if ! command -v uv >/dev/null 2>&1; then
|
||||||
echo "UV not found, installing..."
|
echo "UV not found, installing..."
|
||||||
pipx install uv
|
pipx install uv
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==> Setting up Python environment..."
|
# if no venv, create one
|
||||||
uv venv && . .venv/bin/activate
|
if [ ! -d "$HOME/.venv" ]; then
|
||||||
|
echo "==> Creating virtual environment..."
|
||||||
|
uv venv "$HOME/.venv"
|
||||||
|
fi
|
||||||
|
. "$HOME/.venv/bin/activate"
|
||||||
|
|
||||||
echo "==> Installing dependencies..."
|
echo "==> Installing dependencies..."
|
||||||
uv pip install --requirement requirements.txt
|
uv pip install --requirement requirements.txt
|
||||||
|
|
@ -27,4 +29,14 @@ uv pip install --requirement requirements.txt
|
||||||
echo "==> Installing pre-commit hooks..."
|
echo "==> Installing pre-commit hooks..."
|
||||||
pre-commit install
|
pre-commit install
|
||||||
|
|
||||||
|
echo "==> Updating shell environment..."
|
||||||
|
if ! grep -q "source $HOME/.venv/bin/activate" ~/.bashrc; then
|
||||||
|
echo "source $HOME/.venv/bin/activate" >> ~/.bashrc
|
||||||
|
fi
|
||||||
|
if [ -f ~/.zshrc ]; then
|
||||||
|
if ! grep -q "source $HOME/.venv/bin/activate" ~/.zshrc; then
|
||||||
|
echo "source $HOME/.venv/bin/activate" >> ~/.zshrc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "==> Bootstrap completed!"
|
echo "==> Bootstrap completed!"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ set -e
|
||||||
cd "$(dirname "$0")/.."
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
if [ -z "$VIRTUAL_ENV" ]; then
|
if [ -z "$VIRTUAL_ENV" ]; then
|
||||||
. .venv/bin/activate
|
. "$HOME/.venv/bin/activate"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create config dir if not present
|
# Create config dir if not present
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue