Commit 9ee547d7 authored by Your Name's avatar Your Name

Improve venv handling to use system-installed aisbf package

- Create venv with --system-site-packages flag to access system aisbf
- Remove redundant aisbf package installation in venv
- Venv now only contains requirements.txt dependencies
- On upgrade detection, only update requirements.txt dependencies
- System-installed aisbf package is automatically accessible in venv
parent 1d62a6d8
......@@ -92,7 +92,8 @@ check_package_upgrade() {
ensure_venv() {
if [ ! -d "$VENV_DIR" ]; then
echo "Creating virtual environment at $VENV_DIR"
python3 -m venv "$VENV_DIR"
# Create venv with --system-site-packages to access system-installed aisbf
python3 -m venv --system-site-packages "$VENV_DIR"
# Install requirements if requirements.txt exists
if [ -f "$SHARE_DIR/requirements.txt" ]; then
......@@ -100,18 +101,13 @@ ensure_venv() {
"$VENV_DIR/bin/pip" install -r "$SHARE_DIR/requirements.txt"
fi
# Install aisbf package from system site-packages into venv
# This allows the venv to find the aisbf module
echo "Installing aisbf package in venv"
"$VENV_DIR/bin/pip" install aisbf
# Save version for future upgrade detection
python3 -c "import aisbf; print(aisbf.__version__)" > "$VENV_DIR/.aisbf_version" 2>/dev/null || echo "unknown" > "$VENV_DIR/.aisbf_version"
else
# Check if package was upgraded via pip
if check_package_upgrade; then
echo "Package upgrade detected, updating venv..."
"$VENV_DIR/bin/pip" install --upgrade aisbf
echo "Package upgrade detected, updating venv dependencies..."
# Only update requirements, aisbf is accessed from system site-packages
if [ -f "$SHARE_DIR/requirements.txt" ]; then
"$VENV_DIR/bin/pip" install -r "$SHARE_DIR/requirements.txt"
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment