File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change 1010
1111# Function to cleanup on exit
1212cleanup () {
13- if [ -d " venv " ]; then
13+ if [ " $USE_VENV " = true ]; then
1414 deactivate 2> /dev/null || true
1515 rm -rf venv
1616 fi
@@ -19,14 +19,29 @@ cleanup() {
1919# Set trap to cleanup on exit (success or failure)
2020trap cleanup EXIT
2121
22- # Check if virtual environment exists
22+ USE_VENV=false
23+
24+ # Try to create a venv, if that fails fall back to installing packages
2325if [ ! -d " venv" ]; then
2426 echo " Creating virtual environment..."
25- python3 -m venv venv
27+ if python3 -m venv venv 2> /tmp/venv_err.log; then
28+ USE_VENV=true
29+ else
30+ echo " Warning: could not create venv, falling back to user site-packages."
31+ cat /tmp/venv_err.log
32+ rm -rf venv
33+ fi
34+ else
35+ USE_VENV=true
2636fi
2737
28- source venv/bin/activate
29- pip install -r scripts/table-of-contents-generator/requirements.txt
38+ if [ " $USE_VENV " = true ]; then
39+ . venv/bin/activate
40+ pip install -r scripts/table-of-contents-generator/requirements.txt
41+ else
42+ # No working venv, install deps
43+ python3 -m pip install --user -r scripts/table-of-contents-generator/requirements.txt
44+ fi
3045
3146# Define all TOC generation commands
3247COMMANDS=(
You can’t perform that action at this time.
0 commit comments