From e697104f03e3380b2827d82859c260241857e4fc Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Wed, 26 Dec 2018 13:05:02 -0500 Subject: [PATCH 1/3] Remove sphinx static dir This is already handled by the rtd-sphinx-extension. We don't override the template from rtd (#1946) --- readthedocs/doc_builder/backends/sphinx.py | 3 +-- readthedocs/doc_builder/constants.py | 1 - readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/readthedocs/doc_builder/backends/sphinx.py b/readthedocs/doc_builder/backends/sphinx.py index 3cfe5766d..e8070fcd6 100644 --- a/readthedocs/doc_builder/backends/sphinx.py +++ b/readthedocs/doc_builder/backends/sphinx.py @@ -27,7 +27,7 @@ from readthedocs.restapi.client import api from readthedocs.projects.models import Feature from ..base import BaseBuilder, restoring_chdir -from ..constants import PDF_RE, SPHINX_STATIC_DIR, SPHINX_TEMPLATE_DIR +from ..constants import PDF_RE, SPHINX_TEMPLATE_DIR from ..environments import BuildCommand, DockerBuildCommand from ..exceptions import BuildEnvironmentError from ..signals import finalize_sphinx_context_data @@ -114,7 +114,6 @@ class BaseSphinx(BaseBuilder): 'project': self.project, 'version': self.version, 'settings': settings, - 'static_path': SPHINX_STATIC_DIR, 'template_path': SPHINX_TEMPLATE_DIR, 'conf_py_path': conf_py_path, 'api_host': getattr( diff --git a/readthedocs/doc_builder/constants.py b/readthedocs/doc_builder/constants.py index 14598ea00..518a2c9f9 100644 --- a/readthedocs/doc_builder/constants.py +++ b/readthedocs/doc_builder/constants.py @@ -24,7 +24,6 @@ MKDOCS_TEMPLATE_DIR = os.path.join( 'templates', 'mkdocs', ) -SPHINX_STATIC_DIR = os.path.join(SPHINX_TEMPLATE_DIR, '_static') PDF_RE = re.compile('Output written on (.*?)') diff --git a/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl b/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl index a5f0d064c..e36cdd16a 100644 --- a/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl +++ b/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl @@ -37,7 +37,6 @@ if not 'html_static_path' in globals(): html_static_path = [] if os.path.exists('_static'): html_static_path.append('_static') -html_static_path.append('{{ static_path }}') # Add RTD Theme only if they aren't overriding it already using_rtd_theme = ( From 95323e0518f55a45eda4da00758d31231edfc201 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Wed, 26 Dec 2018 13:27:48 -0500 Subject: [PATCH 2/3] Remove sphinx template dir --- readthedocs/doc_builder/backends/sphinx.py | 4 +--- readthedocs/doc_builder/constants.py | 6 ------ readthedocs/doc_builder/environments.py | 5 ----- readthedocs/templates/sphinx/conf.py.conf | 2 +- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/readthedocs/doc_builder/backends/sphinx.py b/readthedocs/doc_builder/backends/sphinx.py index e8070fcd6..1d280b8a3 100644 --- a/readthedocs/doc_builder/backends/sphinx.py +++ b/readthedocs/doc_builder/backends/sphinx.py @@ -27,7 +27,7 @@ from readthedocs.restapi.client import api from readthedocs.projects.models import Feature from ..base import BaseBuilder, restoring_chdir -from ..constants import PDF_RE, SPHINX_TEMPLATE_DIR +from ..constants import PDF_RE from ..environments import BuildCommand, DockerBuildCommand from ..exceptions import BuildEnvironmentError from ..signals import finalize_sphinx_context_data @@ -63,7 +63,6 @@ class BaseSphinx(BaseBuilder): 'sphinx/conf.py.conf', { 'project': self.project, 'version': self.version, - 'template_dir': SPHINX_TEMPLATE_DIR, 'master_doc': master_doc, }) conf_file = os.path.join(docs_dir, 'conf.py') @@ -114,7 +113,6 @@ class BaseSphinx(BaseBuilder): 'project': self.project, 'version': self.version, 'settings': settings, - 'template_path': SPHINX_TEMPLATE_DIR, 'conf_py_path': conf_py_path, 'api_host': getattr( settings, diff --git a/readthedocs/doc_builder/constants.py b/readthedocs/doc_builder/constants.py index 518a2c9f9..1cd1a5b13 100644 --- a/readthedocs/doc_builder/constants.py +++ b/readthedocs/doc_builder/constants.py @@ -12,12 +12,6 @@ from django.conf import settings log = logging.getLogger(__name__) -SPHINX_TEMPLATE_DIR = os.path.join( - settings.SITE_ROOT, - 'readthedocs', - 'templates', - 'sphinx', -) MKDOCS_TEMPLATE_DIR = os.path.join( settings.SITE_ROOT, 'readthedocs', diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py index d48fc7364..b8980ec69 100644 --- a/readthedocs/doc_builder/environments.py +++ b/readthedocs/doc_builder/environments.py @@ -43,7 +43,6 @@ from .constants import ( DOCKER_TIMEOUT_EXIT_CODE, DOCKER_VERSION, MKDOCS_TEMPLATE_DIR, - SPHINX_TEMPLATE_DIR, ) from .exceptions import ( BuildEnvironmentCreationFailed, @@ -866,10 +865,6 @@ class DockerBuildEnvironment(BuildEnvironment): ``client.create_container``. """ binds = { - SPHINX_TEMPLATE_DIR: { - 'bind': SPHINX_TEMPLATE_DIR, - 'mode': 'ro', - }, MKDOCS_TEMPLATE_DIR: { 'bind': MKDOCS_TEMPLATE_DIR, 'mode': 'ro', diff --git a/readthedocs/templates/sphinx/conf.py.conf b/readthedocs/templates/sphinx/conf.py.conf index 5854c692a..43e7b58b2 100644 --- a/readthedocs/templates/sphinx/conf.py.conf +++ b/readthedocs/templates/sphinx/conf.py.conf @@ -7,7 +7,7 @@ from datetime import datetime from recommonmark.parser import CommonMarkParser extensions = [] -templates_path = ['{{ template_dir }}', 'templates', '_templates', '.templates'] +templates_path = ['templates', '_templates', '.templates'] source_suffix = ['.rst', '.md'] source_parsers = { '.md': CommonMarkParser, From 61852a2ed5b7497ba0dab1583687f6e657c90eb9 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Wed, 26 Dec 2018 21:04:12 -0500 Subject: [PATCH 3/3] Fix tests --- readthedocs/rtd_tests/files/conf.py | 2 +- readthedocs/rtd_tests/tests/test_doc_builder.py | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/readthedocs/rtd_tests/files/conf.py b/readthedocs/rtd_tests/files/conf.py index 1b65e7b52..4007dcfab 100644 --- a/readthedocs/rtd_tests/files/conf.py +++ b/readthedocs/rtd_tests/files/conf.py @@ -7,7 +7,7 @@ from datetime import datetime from recommonmark.parser import CommonMarkParser extensions = [] -templates_path = ['/tmp/sphinx-template-dir', 'templates', '_templates', '.templates'] +templates_path = ['templates', '_templates', '.templates'] source_suffix = ['.rst', '.md'] source_parsers = { '.md': CommonMarkParser, diff --git a/readthedocs/rtd_tests/tests/test_doc_builder.py b/readthedocs/rtd_tests/tests/test_doc_builder.py index 154ace66c..a384f5d00 100644 --- a/readthedocs/rtd_tests/tests/test_doc_builder.py +++ b/readthedocs/rtd_tests/tests/test_doc_builder.py @@ -71,10 +71,6 @@ class SphinxBuilderTest(TestCase): expected ) - @patch( - 'readthedocs.doc_builder.backends.sphinx.SPHINX_TEMPLATE_DIR', - '/tmp/sphinx-template-dir', - ) @patch('readthedocs.doc_builder.backends.sphinx.BaseSphinx.docs_dir') @patch('readthedocs.doc_builder.backends.sphinx.BaseSphinx.create_index') @patch('readthedocs.doc_builder.backends.sphinx.BaseSphinx.get_config_params') @@ -131,10 +127,6 @@ class SphinxBuilderTest(TestCase): ef.readlines()[:autogenerated_confpy_lines] ) - @patch( - 'readthedocs.doc_builder.backends.sphinx.SPHINX_TEMPLATE_DIR', - '/tmp/sphinx-template-dir', - ) @patch('readthedocs.doc_builder.backends.sphinx.BaseSphinx.docs_dir') @patch('readthedocs.doc_builder.backends.sphinx.BaseSphinx.create_index') @patch('readthedocs.doc_builder.backends.sphinx.BaseSphinx.get_config_params')