12
12
import structlog
13
13
from django .conf import settings
14
14
from django .template import loader as template_loader
15
- from django .template .loader import render_to_string
16
15
from django .urls import reverse
17
16
from requests .exceptions import ConnectionError
18
17
24
23
from readthedocs .projects .exceptions import ProjectConfigurationError , UserFileNotFound
25
24
from readthedocs .projects .models import Feature
26
25
from readthedocs .projects .templatetags .projects_tags import sort_version_aware
27
- from readthedocs .projects .utils import safe_write
28
26
29
27
from ..base import BaseBuilder
30
28
from ..constants import PDF_RE
@@ -113,25 +111,6 @@ def __init__(self, *args, **kwargs):
113
111
# because Read the Docs will automatically create one for it.
114
112
pass
115
113
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
-
135
114
def get_config_params (self ):
136
115
"""Get configuration parameters to be rendered into the conf file."""
137
116
# TODO this should be handled better in the theme
@@ -272,18 +251,10 @@ def get_config_params(self):
272
251
273
252
def append_conf (self ):
274
253
"""
275
- Find or create a ``conf.py`` and appends default content.
254
+ Find a ``conf.py`` and appends default content.
276
255
277
256
The default content is rendered from ``doc_builder/conf.py.tmpl``.
278
257
"""
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
-
287
258
try :
288
259
self .config_file = (
289
260
self .config_file or self .project .conf_file (self .version .slug )
@@ -310,7 +281,7 @@ def append_conf(self):
310
281
outfile .write (rendered )
311
282
312
283
# 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
314
285
self .run (
315
286
'cat' ,
316
287
os .path .relpath (
0 commit comments