Skip to content

Commit 226a971

Browse files
committed
Build: do not auto-create conf.py Sphinx file
Follows https://blog.readthedocs.com/doctool-without-configuration-file/
1 parent 60ff7d6 commit 226a971

File tree

2 files changed

+2
-59
lines changed

2 files changed

+2
-59
lines changed

readthedocs/doc_builder/backends/sphinx.py

+2-31
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import structlog
1313
from django.conf import settings
1414
from django.template import loader as template_loader
15-
from django.template.loader import render_to_string
1615
from django.urls import reverse
1716
from requests.exceptions import ConnectionError
1817

@@ -24,7 +23,6 @@
2423
from readthedocs.projects.exceptions import ProjectConfigurationError, UserFileNotFound
2524
from readthedocs.projects.models import Feature
2625
from readthedocs.projects.templatetags.projects_tags import sort_version_aware
27-
from readthedocs.projects.utils import safe_write
2826

2927
from ..base import BaseBuilder
3028
from ..constants import PDF_RE
@@ -113,25 +111,6 @@ def __init__(self, *args, **kwargs):
113111
# because Read the Docs will automatically create one for it.
114112
pass
115113

116-
def _write_config(self, master_doc='index'):
117-
"""Create ``conf.py`` if it doesn't exist."""
118-
log.info(
119-
'Creating default Sphinx config file for project.',
120-
project_slug=self.project.slug,
121-
version_slug=self.version.slug,
122-
)
123-
docs_dir = self.docs_dir()
124-
conf_template = render_to_string(
125-
'sphinx/conf.py.conf',
126-
{
127-
'project': self.project,
128-
'version': self.version,
129-
'master_doc': master_doc,
130-
},
131-
)
132-
conf_file = os.path.join(docs_dir, 'conf.py')
133-
safe_write(conf_file, conf_template)
134-
135114
def get_config_params(self):
136115
"""Get configuration parameters to be rendered into the conf file."""
137116
# TODO this should be handled better in the theme
@@ -272,18 +251,10 @@ def get_config_params(self):
272251

273252
def append_conf(self):
274253
"""
275-
Find or create a ``conf.py`` and appends default content.
254+
Find a ``conf.py`` and appends default content.
276255
277256
The default content is rendered from ``doc_builder/conf.py.tmpl``.
278257
"""
279-
280-
# Generate a `conf.py` from a template
281-
#
282-
# TODO: we should remove this feature at some point to move forward
283-
# with the idea of remove magic from the builders.
284-
if not self.config_file:
285-
self._write_config()
286-
287258
try:
288259
self.config_file = (
289260
self.config_file or self.project.conf_file(self.version.slug)
@@ -310,7 +281,7 @@ def append_conf(self):
310281
outfile.write(rendered)
311282

312283
# Print the contents of conf.py in order to make the rendered
313-
# configfile visible in the build logs
284+
# config file visible in the build logs
314285
self.run(
315286
'cat',
316287
os.path.relpath(

readthedocs/templates/sphinx/conf.py.conf

-28
This file was deleted.

0 commit comments

Comments
 (0)