Paul Vinciguerra | a26f544 | 2020-03-11 13:28:27 -0400 | [diff] [blame] | 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') |
Jon Loeliger | 3227e49 | 2020-12-07 10:57:46 -0500 | [diff] [blame] | 14 | OS_VERSION=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') |
jdenisco | 3138d72 | 2018-09-24 14:59:33 -0400 | [diff] [blame] | 15 | |
| 16 | if [ "$1" == "venv" ] |
| 17 | then |
Paul Vinciguerra | a26f544 | 2020-03-11 13:28:27 -0400 | [diff] [blame] | 18 | # We need to install the venv package on new systems |
John DeNisco | 727c653 | 2020-03-20 10:03:47 -0400 | [diff] [blame] | 19 | if [ "$OS_ID" == "ubuntu" ] |
| 20 | then |
Paul Vinciguerra | a26f544 | 2020-03-11 13:28:27 -0400 | [diff] [blame] | 21 | sudo apt-get install $CONFIRM python3-venv |
John DeNisco | 727c653 | 2020-03-20 10:03:47 -0400 | [diff] [blame] | 22 | fi |
| 23 | if [ "$OS_ID" == "centos" ] |
| 24 | then |
Jon Loeliger | 3227e49 | 2020-12-07 10:57:46 -0500 | [diff] [blame] | 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 |
John DeNisco | 727c653 | 2020-03-20 10:03:47 -0400 | [diff] [blame] | 31 | fi |
Paul Vinciguerra | a26f544 | 2020-03-11 13:28:27 -0400 | [diff] [blame] | 32 | |
| 33 | # Install the virtual environment |
| 34 | $PYTHON_INTERP -m venv $VENV_DIR |
jdenisco | 3138d72 | 2018-09-24 14:59:33 -0400 | [diff] [blame] | 35 | source $VENV_DIR/bin/activate; |
Paul Vinciguerra | a26f544 | 2020-03-11 13:28:27 -0400 | [diff] [blame] | 36 | $PYTHON_INTERP -m pip install wheel==0.34.2 |
| 37 | $PYTHON_INTERP -m pip install -r $DOCS_DIR/etc/requirements.txt |
jdenisco | 3138d72 | 2018-09-24 14:59:33 -0400 | [diff] [blame] | 38 | else |
| 39 | source $VENV_DIR/bin/activate; |
jdenisco | 65ed2d0 | 2018-11-06 12:32:33 -0500 | [diff] [blame] | 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 |
jdenisco | 3138d72 | 2018-09-24 14:59:33 -0400 | [diff] [blame] | 45 | make -C $DOCS_DIR $1 |
| 46 | fi |
| 47 | |
| 48 | deactivate |