blob: b00fb228ca751d6ac43e3eeb798a41076834a0b7 [file] [log] [blame]
Paul Vinciguerraa26f5442020-03-11 13:28:27 -04001#!/bin/bash -ex
2
3# Not refactored to root Makefile because CI calls this from
4# makefile in /docs (as if 'make -C docs').
5if [ -z "$PYTHON" ]
6then
7PYTHON_INTERP=python3
8else
9PYTHON_INTERP=$(PYTHON)
10fi
11
12# Get the OS
13OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
Jon Loeliger3227e492020-12-07 10:57:46 -050014OS_VERSION=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g')
jdenisco3138d722018-09-24 14:59:33 -040015
16if [ "$1" == "venv" ]
17then
Paul Vinciguerraa26f5442020-03-11 13:28:27 -040018 # We need to install the venv package on new systems
John DeNisco727c6532020-03-20 10:03:47 -040019 if [ "$OS_ID" == "ubuntu" ]
20 then
Paul Vinciguerraa26f5442020-03-11 13:28:27 -040021 sudo apt-get install $CONFIRM python3-venv
John DeNisco727c6532020-03-20 10:03:47 -040022 fi
23 if [ "$OS_ID" == "centos" ]
24 then
Jon Loeliger3227e492020-12-07 10:57:46 -050025 if [ "$OS_VERSION" == "8" ]
26 then
27 sudo yum install $CONFIRM python3-virtualenv
28 else
29 sudo yum install $CONFIRM python3-venv
30 fi
John DeNisco727c6532020-03-20 10:03:47 -040031 fi
Paul Vinciguerraa26f5442020-03-11 13:28:27 -040032
33 # Install the virtual environment
34 $PYTHON_INTERP -m venv $VENV_DIR
jdenisco3138d722018-09-24 14:59:33 -040035 source $VENV_DIR/bin/activate;
Paul Vinciguerraa26f5442020-03-11 13:28:27 -040036 $PYTHON_INTERP -m pip install wheel==0.34.2
37 $PYTHON_INTERP -m pip install -r $DOCS_DIR/etc/requirements.txt
jdenisco3138d722018-09-24 14:59:33 -040038else
39 source $VENV_DIR/bin/activate;
jdenisco65ed2d02018-11-06 12:32:33 -050040 VERSION=`source $WS_ROOT/src/scripts/version`
41 TM=`TZ=GMT date`
42 sed -ie "s/**VPP Version:\*\* .*/**VPP Version:** $VERSION/" $DOCS_DIR/about.rst
43 sed -ie "s/**Built on:\*\* .*/**Built on:** $TM/" $DOCS_DIR/about.rst
44 rm $DOCS_DIR/about.rste
jdenisco3138d722018-09-24 14:59:33 -040045 make -C $DOCS_DIR $1
46fi
47
48deactivate