forked from ArduPilot/ardupilot_wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sphinxsetup.sh
executable file
·74 lines (58 loc) · 2.4 KB
/
Sphinxsetup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
set -e
set -x
if [ "$UID" -eq 0 ]; then
echo "Sorry, this script must NOT be run as ROOT!"
exit 1
fi
DISTRIBUTION_ID=$(lsb_release -i -s)
if [ ${DISTRIBUTION_ID} = 'Ubuntu' ]; then
DISTRIBUTION_CODENAME=$(lsb_release -c -s)
if [ ${DISTRIBUTION_CODENAME} = 'focal' ] || [ ${DISTRIBUTION_CODENAME} = 'bionic' ]; then
sudo add-apt-repository universe
fi
fi
sudo apt-get -y update
sudo apt-get install -y unzip git imagemagick curl wget make python3
# Install packages release specific
if [ ${DISTRIBUTION_CODENAME} = 'bionic' ]; then
sudo apt-get install -y python3-distutils
fi
# For WSL (esp. version 2) make DISPLAY empty to allow pip to run
STORED_DISPLAY_VALUE=$DISPLAY
if grep -qi -E '(Microsoft|WSL)' /proc/version; then
echo "Temporarily clearing the DISPLAY variable because this is WSL"
export DISPLAY=
fi
# Get pip through the official website to get the latest release
GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py"
# accomodate default Python on bionic:
if [ "$(python --version)" == "Python 3.6.9" ]; then
GET_PIP_URL="https://bootstrap.pypa.io/pip/3.6/get-pip.py"
fi
curl "$GET_PIP_URL" -o get-pip.py
python3 get-pip.py
rm -f get-pip.py
# Install python packages using known working versions
# Install sphinx with a specific docutils version
# Docutils version is for correct bullet point rendering. Can be rolled forward after theme is updated to >=0.5.1
# See https://stackoverflow.com/a/68685753/2578171
python3 -m pip install --user --upgrade sphinx==5.1.1 docutils==0.16
# lxml for parameter parsing:
python3 -m pip install --user --upgrade lxml
# Install sphinx theme from ArduPilot repository
python3 -m pip install --user --upgrade git+https://github.com/ArduPilot/sphinx_rtd_theme.git
# and youtube and video plugins:
# This command might require a --force option if you have and older extension installed
# Rerun Sphinxsetup.sh after doing that
python3 -m pip install --user --upgrade git+https://github.com/ArduPilot/sphinxcontrib-youtube.git
# and a parser to use getting posts from Discourse (forum) and insert in FrontEnd
python3 -m pip install --user --upgrade beautifulsoup4
# Install flake8
python3 -m pip install --user --upgrade flake8==3.7.9
# Reset the value of DISPLAY
if grep -qi -E '(Microsoft|WSL)' /proc/version; then
echo "Returning DISPLAY to the previous value in WSL"
export DISPLAY=$STORED_DISPLAY_VALUE
fi
echo "Setup completed successfully!"