Skip to content

Commit 1788629

Browse files
authored
Don't require sphinx/mkdocs keys when using build.commands (#11913)
Closes #11912
1 parent 9b99c47 commit 1788629

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

readthedocs/config/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,12 +753,16 @@ def validate_deprecated_implicit_keys(self):
753753
"""
754754
Check for deprecated usages and raise an exception if found.
755755
756+
- If the user is using build.commands, we don't need the sphinx or mkdocs keys.
756757
- If the sphinx key is used, a path to the configuration file is required.
757758
- If the mkdocs key is used, a path to the configuration file is required.
758759
- If none of the sphinx or mkdocs keys are used,
759760
and the user isn't overriding the new build jobs,
760761
the sphinx key is explicitly required.
761762
"""
763+
if self.is_using_build_commands:
764+
return
765+
762766
has_sphinx_key = "sphinx" in self.source_config
763767
has_mkdocs_key = "mkdocs" in self.source_config
764768
if has_sphinx_key and not self.sphinx.configuration:

readthedocs/config/tests/test_config.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,6 +1864,18 @@ def test_config_without_sphinx_key(self):
18641864
data_copy["build"]["jobs"]["build"] = {"html": ["echo 'Hello World'"]}
18651865
get_build_config(data_copy, validate=True, deprecate_implicit_keys=True)
18661866

1867+
def test_sphinx_and_mkdocs_arent_required_when_using_build_commands(self):
1868+
data = {
1869+
"build": {
1870+
"os": "ubuntu-22.04",
1871+
"tools": {
1872+
"python": "3",
1873+
},
1874+
"commands": ["echo 'Hello World'"],
1875+
},
1876+
}
1877+
get_build_config(data, validate=True, deprecate_implicit_keys=True)
1878+
18671879
def test_as_dict_new_build_config(self, tmpdir):
18681880
build = get_build_config(
18691881
{

0 commit comments

Comments
 (0)