Skip to content

Conversation

@prathambande
Copy link
Collaborator

With this PR, we conditionally check for activate script inside bin of venv to proceed ahead with its activation.
Script generated which contains the PR changes:

#!/bin/sh

echo 'export APP_PATH="/home/site/wwwroot"' >> ~/.bashrc
echo 'cd $APP_PATH' >> ~/.bashrc

# Enter the source directory to make sure the script runs where the user expects
cd /home/site/wwwroot

export APP_PATH="/home/site/wwwroot"
if [ -z "$HOST" ]; then
                export HOST=0.0.0.0
fi

if [ -z "$PORT" ]; then
                export PORT=80
fi

export PATH="/opt/python/3.13.11/bin:${PATH}"
echo 'export VIRTUALENVIRONMENT_PATH="/antenv"' >> ~/.bashrc
echo 'if [ -f /antenv/bin/activate ]; then . /antenv/bin/activate; fi' >> ~/.bashrc
echo Found virtual environment .tar.gz archive.
extractionCommand="tar -xzf antenv.tar.gz -C /antenv"
echo Removing existing virtual environment directory '/antenv'...
rm -fr /antenv
mkdir -p /antenv
echo Extracting to directory '/antenv'...
$extractionCommand
if [ -d antenv ]; then
    mv -f antenv _del_antenv || true
fi

if [ -d /antenv ]; then
    ln -sfn /antenv ./antenv
fi

echo "Done."
PYTHON_VERSION=$(python -c "import sys; print(str(sys.version_info.major) + '.' + str(sys.version_info.minor))")
echo Using packages from virtual environment 'antenv' located at '/antenv'.
export PYTHONPATH=$PYTHONPATH:"/antenv/lib/python$PYTHON_VERSION/site-packages"
echo "Updated PYTHONPATH to '$PYTHONPATH'"
if [ -f /antenv/bin/activate ]; then . /antenv/bin/activate; fi

Example:
image

@prathambande prathambande requested a review from a team as a code owner January 28, 2026 12:53
@prathambande prathambande merged commit 7829e36 into main Jan 28, 2026
9 checks passed
@prathambande prathambande deleted the dev/prathambande/handle-absense-of-activate branch January 28, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants