docs: Fix CentOS 8 build
[vpp.git] / docs / scripts / sphinx-make.sh
1 #!/bin/bash -ex
2
3 # Not refactored to root Makefile because CI calls this from
4 # makefile in /docs (as if 'make -C docs').
5 if [ -z "$PYTHON" ]
6 then
7 PYTHON_INTERP=python3
8 else
9 PYTHON_INTERP=$(PYTHON)
10 fi
11
12 # Get the OS
13 OS_ID=$(grep '^ID=' /etc/os-release  | cut -f2- -d= | sed -e 's/\"//g')
14 OS_VERSION=$(grep '^VERSION_ID=' /etc/os-release  | cut -f2- -d= | sed -e 's/\"//g')
15
16 if [ "$1" == "venv" ]
17 then
18     # We need to install the venv package on new systems
19     if [ "$OS_ID" == "ubuntu" ]
20     then
21         sudo apt-get install $CONFIRM python3-venv
22     fi
23     if [ "$OS_ID" == "centos" ]
24     then
25         if [ "$OS_VERSION" == "8" ]
26         then
27             sudo yum install $CONFIRM python3-virtualenv
28         else
29             sudo yum install $CONFIRM python3-venv
30         fi
31     fi
32
33     # Install the virtual environment
34     $PYTHON_INTERP -m venv $VENV_DIR
35     source $VENV_DIR/bin/activate;
36     $PYTHON_INTERP -m pip install wheel==0.34.2
37     $PYTHON_INTERP -m pip install -r $DOCS_DIR/etc/requirements.txt
38 else
39     source $VENV_DIR/bin/activate;
40     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
45     make -C $DOCS_DIR $1
46 fi
47
48 deactivate