Skip to content

Commit 440ddc5

Browse files
committed
Improve naming
1 parent bdc4d0f commit 440ddc5

File tree

5 files changed

+38
-38
lines changed

5 files changed

+38
-38
lines changed

readthedocs/doc_builder/builder.py renamed to readthedocs/doc_builder/director.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
log = structlog.get_logger(__name__)
1717

1818

19-
class DocumentationBuilder:
19+
class BuildDirector:
2020

2121
"""
2222
Encapsulates all the logic to perform a build for user's documentation.
@@ -45,7 +45,7 @@ def __init__(self, data):
4545
"""
4646
self.data = data
4747

48-
def vcs(self):
48+
def setup_vcs(self):
4949
"""
5050
Perform all VCS related steps.
5151

readthedocs/projects/tasks/builds.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from readthedocs.builds.models import Build
3333
from readthedocs.builds.signals import build_complete
3434
from readthedocs.config import ConfigError
35-
from readthedocs.doc_builder.builder import DocumentationBuilder
35+
from readthedocs.doc_builder.director import BuildDirector
3636
from readthedocs.doc_builder.environments import (
3737
DockerBuildEnvironment,
3838
LocalBuildEnvironment,
@@ -536,25 +536,25 @@ def update_build(self, state):
536536
log.exception('Unable to update build')
537537

538538
def execute(self):
539-
self.data.builder = DocumentationBuilder(
539+
self.data.build_director = BuildDirector(
540540
data=self.data,
541541
)
542542

543543
# Clonning
544544
self.update_build(state=BUILD_STATE_CLONING)
545-
self.data.builder.vcs()
545+
self.data.build_director.setup_vcs()
546546

547547
# Sync tags/branches from VCS repository into Read the Docs' `Version`
548548
# objects in the database
549-
self.sync_versions(self.data.builder.vcs_repository)
549+
self.sync_versions(self.data.build_director.vcs_repository)
550550

551551
# Installing
552552
self.update_build(state=BUILD_STATE_INSTALLING)
553-
self.data.builder.setup_environment()
553+
self.data.build_director.setup_environment()
554554

555555
# Building
556556
self.update_build(state=BUILD_STATE_BUILDING)
557-
self.data.builder.build()
557+
self.data.build_director.build()
558558

559559
@staticmethod
560560
def get_project(project_pk):

readthedocs/projects/tasks/mixins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def sync_versions(self, vcs_repository):
5555

5656
# NOTE: `sync_versions` should receive `tags` and `branches` already
5757
# and just validate them trigger the task. All the other logic should
58-
# be done by the DocumentationBuilder or the VCS backend. We should not
58+
# be done by the BuildDirector or the VCS backend. We should not
5959
# check this here and do not depend on ``vcs_repository``.
6060

6161
tags = None

readthedocs/projects/tests/test_build_tasks.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class TestBuildTask(BuildEnvironmentBase):
8989
("all", ["latex", "readthedocssinglehtmllocalmedia", "nepub"]),
9090
),
9191
)
92-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
92+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
9393
@pytest.mark.skip
9494
def test_build_sphinx_formats(self, load_yaml_config, formats, builders):
9595
load_yaml_config.return_value = self._config_file(
@@ -145,8 +145,8 @@ def test_build_sphinx_formats(self, load_yaml_config, formats, builders):
145145
)
146146
)
147147

148-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
149-
@mock.patch("readthedocs.doc_builder.builder.DocumentationBuilder.build_docs_class")
148+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
149+
@mock.patch("readthedocs.doc_builder.director.BuildDirector.build_docs_class")
150150
def test_build_formats_only_html_for_external_versions(
151151
self, build_docs_class, load_yaml_config
152152
):
@@ -166,8 +166,8 @@ def test_build_formats_only_html_for_external_versions(
166166

167167
build_docs_class.assert_called_once_with("sphinx") # HTML builder
168168

169-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
170-
@mock.patch("readthedocs.doc_builder.builder.DocumentationBuilder.build_docs_class")
169+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
170+
@mock.patch("readthedocs.doc_builder.director.BuildDirector.build_docs_class")
171171
def test_build_respects_formats_mkdocs(self, build_docs_class, load_yaml_config):
172172
load_yaml_config.return_value = self._config_file(
173173
{
@@ -183,7 +183,7 @@ def test_build_respects_formats_mkdocs(self, build_docs_class, load_yaml_config)
183183

184184
build_docs_class.assert_called_once_with("mkdocs") # HTML builder
185185

186-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
186+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
187187
@pytest.mark.skip()
188188
# NOTE: find a way to test we are passing all the environment variables to all the commands
189189
def test_get_env_vars_default(self, load_yaml_config):
@@ -236,7 +236,7 @@ def test_get_env_vars_default(self, load_yaml_config):
236236
@mock.patch("readthedocs.projects.tasks.builds.send_external_build_status")
237237
@mock.patch("readthedocs.projects.tasks.builds.UpdateDocsTask.send_notifications")
238238
@mock.patch("readthedocs.projects.tasks.builds.clean_build")
239-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
239+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
240240
def test_successful_build(
241241
self,
242242
load_yaml_config,
@@ -462,7 +462,7 @@ def test_failed_build(
462462
"success": False,
463463
}
464464

465-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
465+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
466466
def test_build_commands_executed(self, load_yaml_config):
467467
load_yaml_config.return_value = self._config_file(
468468
{
@@ -635,7 +635,7 @@ def test_build_commands_executed(self, load_yaml_config):
635635
]
636636
)
637637

638-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
638+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
639639
def test_install_apt_packages(self, load_yaml_config):
640640
config = BuildConfigV2(
641641
{},
@@ -677,7 +677,7 @@ def test_install_apt_packages(self, load_yaml_config):
677677
]
678678
)
679679

680-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
680+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
681681
def test_build_tools(self, load_yaml_config):
682682
config = BuildConfigV2(
683683
{},
@@ -732,7 +732,7 @@ def test_build_tools(self, load_yaml_config):
732732

733733
@mock.patch("readthedocs.doc_builder.python_environments.tarfile")
734734
@mock.patch("readthedocs.doc_builder.python_environments.build_tools_storage")
735-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
735+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
736736
def test_build_tools_cached(self, load_yaml_config, build_tools_storage, tarfile):
737737
config = BuildConfigV2(
738738
{},
@@ -803,7 +803,7 @@ def test_build_tools_cached(self, load_yaml_config, build_tools_storage, tarfile
803803
]
804804
)
805805

806-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
806+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
807807
def test_requirements_from_config_file_installed(self, load_yaml_config):
808808
load_yaml_config.return_value = self._config_file(
809809
{
@@ -837,7 +837,7 @@ def test_requirements_from_config_file_installed(self, load_yaml_config):
837837
]
838838
)
839839

840-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
840+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
841841
def test_conda_config_calls_conda_command(self, load_yaml_config):
842842
load_yaml_config.return_value = self._config_file(
843843
{
@@ -895,7 +895,7 @@ def test_conda_config_calls_conda_command(self, load_yaml_config):
895895
]
896896
)
897897

898-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
898+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
899899
def test_python_mamba_commands(self, load_yaml_config):
900900
load_yaml_config.return_value = self._config_file(
901901
{
@@ -947,7 +947,7 @@ def test_python_mamba_commands(self, load_yaml_config):
947947
]
948948
)
949949

950-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
950+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
951951
def test_sphinx_fail_on_warning(self, load_yaml_config):
952952
load_yaml_config.return_value = self._config_file(
953953
{
@@ -985,7 +985,7 @@ def test_sphinx_fail_on_warning(self, load_yaml_config):
985985
]
986986
)
987987

988-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
988+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
989989
def test_mkdocs_fail_on_warning(self, load_yaml_config):
990990
load_yaml_config.return_value = self._config_file(
991991
{
@@ -1018,7 +1018,7 @@ def test_mkdocs_fail_on_warning(self, load_yaml_config):
10181018
]
10191019
)
10201020

1021-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
1021+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
10221022
def test_system_site_packages(self, load_yaml_config):
10231023
load_yaml_config.return_value = self._config_file(
10241024
{
@@ -1044,7 +1044,7 @@ def test_system_site_packages(self, load_yaml_config):
10441044
]
10451045
)
10461046

1047-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
1047+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
10481048
def test_system_site_packages_project_overrides(self, load_yaml_config):
10491049
load_yaml_config.return_value = self._config_file(
10501050
{
@@ -1074,7 +1074,7 @@ def test_system_site_packages_project_overrides(self, load_yaml_config):
10741074
]
10751075
)
10761076

1077-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
1077+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
10781078
def test_python_install_setuptools(self, load_yaml_config):
10791079
load_yaml_config.return_value = self._config_file(
10801080
{
@@ -1105,7 +1105,7 @@ def test_python_install_setuptools(self, load_yaml_config):
11051105
]
11061106
)
11071107

1108-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
1108+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
11091109
def test_python_install_pip(self, load_yaml_config):
11101110
load_yaml_config.return_value = self._config_file(
11111111
{
@@ -1141,7 +1141,7 @@ def test_python_install_pip(self, load_yaml_config):
11411141
]
11421142
)
11431143

1144-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
1144+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
11451145
def test_python_install_pip_extras(self, load_yaml_config):
11461146
# FIXME: the test passes but in the logs there is an error related to
11471147
# `backends/sphinx.py` not finding a file.
@@ -1182,7 +1182,7 @@ def test_python_install_pip_extras(self, load_yaml_config):
11821182
]
11831183
)
11841184

1185-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
1185+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
11861186
def test_python_install_pip_several_options(self, load_yaml_config):
11871187
load_yaml_config.return_value = self._config_file(
11881188
{
@@ -1253,7 +1253,7 @@ def test_python_install_pip_several_options(self, load_yaml_config):
12531253
(["one", "two"], ["one", "two"]),
12541254
],
12551255
)
1256-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
1256+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
12571257
def test_submodules_include(self, load_yaml_config, value, expected):
12581258
load_yaml_config.return_value = self._config_file(
12591259
{
@@ -1273,7 +1273,7 @@ def test_submodules_include(self, load_yaml_config, value, expected):
12731273
]
12741274
)
12751275

1276-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
1276+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
12771277
def test_submodules_exclude(self, load_yaml_config):
12781278
load_yaml_config.return_value = self._config_file(
12791279
{
@@ -1300,7 +1300,7 @@ def test_submodules_exclude(self, load_yaml_config):
13001300
]
13011301
)
13021302

1303-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
1303+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
13041304
def test_submodules_exclude_all(self, load_yaml_config):
13051305
load_yaml_config.return_value = self._config_file(
13061306
{
@@ -1328,7 +1328,7 @@ def test_submodules_exclude_all(self, load_yaml_config):
13281328
("singlehtml", "readthedocssinglehtml"),
13291329
],
13301330
)
1331-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
1331+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
13321332
def test_sphinx_builder(self, load_yaml_config, value, command):
13331333
load_yaml_config.return_value = self._config_file(
13341334
{
@@ -1366,7 +1366,7 @@ def test_sphinx_builder(self, load_yaml_config, value, command):
13661366

13671367

13681368
class TestBuildTaskExceptionHandler(BuildEnvironmentBase):
1369-
@mock.patch("readthedocs.doc_builder.builder.load_yaml_config")
1369+
@mock.patch("readthedocs.doc_builder.director.load_yaml_config")
13701370
def test_config_file_exception(self, load_yaml_config):
13711371
load_yaml_config.side_effect = ConfigError(
13721372
code="invalid", message="Invalid version in config file."

readthedocs/rtd_tests/tests/test_imported_file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def test_update_content(self):
176176

177177
@override_settings(PRODUCTION_DOMAIN="readthedocs.org")
178178
@override_settings(RTD_INTERSPHINX_URL="https://readthedocs.org")
179-
@mock.patch("readthedocs.doc_builder.builder.os.path.exists")
179+
@mock.patch("readthedocs.doc_builder.director.os.path.exists")
180180
def test_create_intersphinx_data(self, mock_exists):
181181
mock_exists.return_Value = True
182182

@@ -255,7 +255,7 @@ def test_create_intersphinx_data(self, mock_exists):
255255
self.assertEqual(ImportedFile.objects.count(), 2)
256256

257257
@override_settings(RTD_INTERSPHINX_URL="http://localhost:8080")
258-
@mock.patch("readthedocs.doc_builder.builder.os.path.exists")
258+
@mock.patch("readthedocs.doc_builder.director.os.path.exists")
259259
def test_custom_intersphinx_url(self, mock_exists):
260260
mock_exists.return_Value = True
261261

0 commit comments

Comments
 (0)