Small update of gammapy/utils/docs.py
@@ -187,6 +187,14 @@ def gammapy_sphinx_notebooks(setup_cfg):
"""
Manages the processes for the building of sphinx formatted notebooks
"""
+ if not bool(setup_cfg['build_notebooks']):
+ log.info('Config build_notebooks is False; skipping notebook processing')
+ return
+
+ if not HAS_GP_EXTRA:
+ log.info('No GAMMAPY_EXTRA found; skipping notebook processing')
+ return
+
url_docs = setup_cfg['url_docs']
git_commit = setup_cfg['git_commit']
@@ -195,7 +203,6 @@ def gammapy_sphinx_notebooks(setup_cfg):
rmtree('notebooks', ignore_errors=True)
# copy and build notebooks
- if (os.environ.get('GAMMAPY_EXTRA') and eval(setup_cfg['build_notebooks'])):
gammapy_extra_notebooks_folder = os.environ['GAMMAPY_EXTRA'] + '/notebooks'
if os.path.isdir(gammapy_extra_notebooks_folder):
ignorefiles = lambda d, files: [
