Skip to content

Commit 44c9e33

Browse files
authored
Merge pull request #4822 from ClickHouse/Blargian-patch-253677
Translations: modification to account for running script in General Translation ag…
2 parents 60565be + f413147 commit 44c9e33

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

scripts/autogenerate-table-of-contents.sh

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set +e
1010

1111
# Function to cleanup on exit
1212
cleanup() {
13-
if [ -d "venv" ]; then
13+
if [ "$USE_VENV" = true ]; then
1414
deactivate 2>/dev/null || true
1515
rm -rf venv
1616
fi
@@ -19,21 +19,36 @@ cleanup() {
1919
# Set trap to cleanup on exit (success or failure)
2020
trap 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
2325
if [ ! -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
2636
fi
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
3247
COMMANDS=(
3348
'--dir="knowledgebase" --single-toc --out="static" --ignore images'
34-
'--verbose --single-toc --dir="docs/operations/system-tables" --md="docs/operations/system-tables/index.md"'
35-
'--verbose --single-toc --dir="docs/operations/settings" --md="docs/operations/settings/index.md"'
36-
'--verbose --single-toc --dir="docs/engines/database-engines" --md="docs/engines/database-engines/index.md"'
49+
'--single-toc --dir="docs/operations/system-tables" --md="docs/operations/system-tables/index.md"'
50+
'--single-toc --dir="docs/operations/settings" --md="docs/operations/settings/index.md"'
51+
'--single-toc --dir="docs/engines/database-engines" --md="docs/engines/database-engines/index.md"'
3752
'--single-toc --dir="docs/engines/table-engines/mergetree-family" --md="docs/engines/table-engines/mergetree-family/index.md"'
3853
'--single-toc --dir="docs/engines/table-engines/integrations" --md="docs/engines/table-engines/integrations/index.md"'
3954
'--single-toc --dir="docs/engines/table-engines/special" --md="docs/engines/table-engines/special/index.md"'

0 commit comments

Comments
 (0)