Skip to content

Commit

Permalink
Add configuration warning for sphinxcontrib-youtube
Browse files Browse the repository at this point in the history
Also adds a work around to keep older build environments functional by using sphinxcontrib.vimeo
  • Loading branch information
TunaLobster authored and Hwurzburg committed Aug 2, 2022
1 parent a3ec80f commit e58c07d
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 128 deletions.
5 changes: 1 addition & 4 deletions Sphinxsetup.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
rem remove any existing packages that may cause conflicts
pip uninstall -y sphinx lxml sphinx-rtd-theme sphinxcontrib-youtube sphinxcontrib.vimeo beautifulsoup4
pip uninstall -y sphinx lxml sphinx-rtd-theme sphinxcontrib-youtube beautifulsoup4

rem Install sphinx
pip install --upgrade sphinx
Expand All @@ -13,9 +13,6 @@ pip install --upgrade git+https://github.com/ArduPilot/sphinx_rtd_theme.git
rem and a youtube plugin:
pip install --upgrade git+https://github.com/sphinx-contrib/youtube.git

rem and a vimeo plugin:
pip install --upgrade git+https://github.com/ArduPilot/sphinxcontrib.vimeo.git

rem and a parser to use getting posts from Discourse (forum) and insert in FrontEnd
pip install --upgrade beautifulsoup4

Expand Down
3 changes: 0 additions & 3 deletions Sphinxsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ python3 -m pip install --user --upgrade git+https://github.com/ArduPilot/sphinx_
# and a youtube plugin:
python3 -m pip install --user --upgrade git+https://github.com/sphinx-contrib/youtube.git

# and a vimeo plugin:
python3 -m pip install --user --upgrade git+https://github.com/ArduPilot/sphinxcontrib.vimeo.git

# and a parser to use getting posts from Discourse (forum) and insert in FrontEnd
python3 -m pip install --user --upgrade beautifulsoup4

Expand Down
13 changes: 1 addition & 12 deletions antennatracker/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,7 @@
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
]
extensions = common_conf.extensions

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
13 changes: 1 addition & 12 deletions ardupilot/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,7 @@
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
]
extensions = common_conf.extensions

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
13 changes: 1 addition & 12 deletions blimp/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,7 @@
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
]
extensions = common_conf.extensions

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
37 changes: 36 additions & 1 deletion common_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,42 @@
#
# This contains common configuration information for the ardupilot wikis.
# This information is imported by the conf.py files in each of the sub wikis
#

import warnings
from packaging import version
import pkg_resources

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', # For youtube embedding
]


def custom_formatwarning(msg, *args, **kwargs):
# ignore everything except the message
return str(msg) + '\n'


warnings.formatwarning = custom_formatwarning

# Check if sphinxcontrib.youtube version is high enough to handle vimeo and older python versions
if version.parse(pkg_resources.get_distribution('sphinxcontrib-youtube').version) < version.parse('1.0.1'):
warnings.warn('\033[93mModule sphinxcontrib-youtube is outdated. PDF documentation cannot be built. ' +
'Please run "python3 -m pip install --upgrade sphinxcontrib-youtube"')
try:
# Check if sphinxcontrib.vimeo extension is present, fallback to using that to handle vimeo
import sphinxcontrib.vimeo # noqa: F401
extensions.append('sphinxcontrib.vimeo') # For vimeo embedding
except ImportError: # change to ModuleNotFoundError when only python >=3.6 is supported
warnings.warn('\033[93mModule sphinxcontrib-youtube is old and sphinxcontrib-vimeo is not installed.' +
'Please run the wiki build setup script.')

# Set False to re-enable warnings for non-local images.
disable_non_local_image_warnings = True
Expand Down
13 changes: 1 addition & 12 deletions copter/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,7 @@
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
]
extensions = common_conf.extensions

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
13 changes: 1 addition & 12 deletions dev/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,7 @@
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
]
extensions = common_conf.extensions

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
13 changes: 1 addition & 12 deletions mavproxy/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,7 @@
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
]
extensions = common_conf.extensions

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
13 changes: 1 addition & 12 deletions plane/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,7 @@
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
]
extensions = common_conf.extensions

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
13 changes: 1 addition & 12 deletions planner/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,7 @@
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
]
extensions = common_conf.extensions

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
13 changes: 1 addition & 12 deletions planner2/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,7 @@
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
]
extensions = common_conf.extensions

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
13 changes: 1 addition & 12 deletions rover/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,7 @@
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.imgmath',
'sphinx.ext.ifconfig',
'sphinxcontrib.youtube', #For youtube embedding
'sphinxcontrib.vimeo', #For vimeo embedding
]
extensions = common_conf.extensions

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down

0 comments on commit e58c07d

Please sign in to comment.