Repository: python/python-docs-es

Issue:
readthedocs: 'extensions' is not defined
Por alguna razón, hemos encontrado https://github.com/UPC/ravada/issues/890 en la CI de readthedocs, y actualmente los builds tienen el siguiente error:

```
% python -m sphinx -T -j auto -E -b html -d _build/doctrees -D language=es . _build/html
Running Sphinx v2.2.0

Traceback (most recent call last):
  File "/home/cmaureir/repos/python-docs-es-admin/venv/lib/python3.9/site-packages/sphinx/config.py", line 361, in eval_config_file
    execfile_(filename, namespace)
  File "/home/cmaureir/repos/python-docs-es-admin/venv/lib/python3.9/site-packages/sphinx/util/pycompat.py", line 81, in execfile_
    exec(code, _globals)
  File "/home/cmaureir/repos/python-docs-es-admin/conf.py", line 22, in <module>
    from conf import *
  File "/home/cmaureir/repos/python-docs-es-admin/conf.py", line 72, in <module>
    if extensions:
NameError: name 'extensions' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/cmaureir/repos/python-docs-es-admin/venv/lib/python3.9/site-packages/sphinx/cmd/build.py", line 272, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/home/cmaureir/repos/python-docs-es-admin/venv/lib/python3.9/site-packages/sphinx/application.py", line 210, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/home/cmaureir/repos/python-docs-es-admin/venv/lib/python3.9/site-packages/sphinx/config.py", line 196, in read
    namespace = eval_config_file(filename, tags)
  File "/home/cmaureir/repos/python-docs-es-admin/venv/lib/python3.9/site-packages/sphinx/config.py", line 371, in eval_config_file
    raise ConfigError(msg % traceback.format_exc())
sphinx.errors.ConfigError: There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/home/cmaureir/repos/python-docs-es-admin/venv/lib/python3.9/site-packages/sphinx/config.py", line 361, in eval_config_file
    execfile_(filename, namespace)
  File "/home/cmaureir/repos/python-docs-es-admin/venv/lib/python3.9/site-packages/sphinx/util/pycompat.py", line 81, in execfile_
    exec(code, _globals)
  File "/home/cmaureir/repos/python-docs-es-admin/conf.py", line 22, in <module>
    from conf import *
  File "/home/cmaureir/repos/python-docs-es-admin/conf.py", line 72, in <module>
    if extensions:
NameError: name 'extensions' is not defined


Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/home/cmaureir/repos/python-docs-es-admin/venv/lib/python3.9/site-packages/sphinx/config.py", line 361, in eval_config_file
    execfile_(filename, namespace)
  File "/home/cmaureir/repos/python-docs-es-admin/venv/lib/python3.9/site-packages/sphinx/util/pycompat.py", line 81, in execfile_
    exec(code, _globals)
  File "/home/cmaureir/repos/python-docs-es-admin/conf.py", line 22, in <module>
    from conf import *
  File "/home/cmaureir/repos/python-docs-es-admin/conf.py", line 72, in <module>
    if extensions:
NameError: name 'extensions' is not defined
```

Localmente `extensions` está definido, pero por alguna razón no en el CI de readthedocs.


Discussion:

Resolving patch:
diff --git a/conf.py b/conf.py
--- a/conf.py
+++ b/conf.py
@@ -69,10 +69,16 @@
      _stdauthor, 'manual'),
 ]
 
-extensions.extend([
-    'sphinx_tabs.tabs',
-    'sphinxemoji.sphinxemoji',
-])
+try:
+    extensions.extend([
+        'sphinx_tabs.tabs',
+        'sphinxemoji.sphinxemoji',
+    ])
+except NameError:
+    extensions = [
+        'sphinx_tabs.tabs',
+        'sphinxemoji.sphinxemoji',
+    ]
 
 
 def setup(app):


Test patch: