Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build: don't run default steps if no sphinx or mkdocs #11810

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion readthedocs/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,14 @@ def doctype(self):

if self.mkdocs:
return "mkdocs"
return self.sphinx.builder

# NOTE: we need to use "source config" here because `_config` is
# auto-populated with Sphinx if no `sphinx` and no `mkdocs` keys are
# declared.
if self.source_config.get("sphinx"):
return self.sphinx.builder

return GENERIC

@property
def submodules(self):
Expand Down
25 changes: 18 additions & 7 deletions readthedocs/doc_builder/director.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def setup_vcs(self):
# self.run_build_job("pre_checkout")
self.checkout()

self.run_default_commands = self.is_type_mkdocs() or self.is_type_sphinx()

self.run_build_job("post_checkout")

commit = self.data.build_commit or self.vcs_repository.commit
Expand Down Expand Up @@ -309,23 +311,28 @@ def create_environment(self):
if self.data.config.build.jobs.create_environment is not None:
self.run_build_job("create_environment")
return
self.language_environment.setup_base()

if self.run_default_commands or self.data.config.source_config.get("python"):
self.language_environment.setup_base()

# Install
def install(self):
if self.data.config.build.jobs.install is not None:
self.run_build_job("install")
return

self.language_environment.install_core_requirements()
self.language_environment.install_requirements()
if self.run_default_commands or self.data.config.source_config.get("python"):
self.language_environment.install_core_requirements()
self.language_environment.install_requirements()

# Build
def build_html(self):
if self.data.config.build.jobs.build.html is not None:
self.run_build_job("build.html")
return
return self.build_docs_class(self.data.config.doctype)

if self.run_default_commands:
return self.build_docs_class(self.data.config.doctype)

def build_pdf(self):
if "pdf" not in self.data.config.formats or self.data.version.type == EXTERNAL:
Expand All @@ -336,7 +343,7 @@ def build_pdf(self):
return

# Mkdocs has no pdf generation currently.
if self.is_type_sphinx():
if self.is_type_sphinx() and self.run_default_commands:
return self.build_docs_class("sphinx_pdf")

return False
Expand All @@ -353,7 +360,7 @@ def build_htmlzip(self):
return

# We don't generate a zip for mkdocs currently.
if self.is_type_sphinx():
if self.is_type_sphinx() and self.run_default_commands:
return self.build_docs_class("sphinx_singlehtmllocalmedia")
return False

Expand All @@ -366,7 +373,7 @@ def build_epub(self):
return

# Mkdocs has no epub generation currently.
if self.is_type_sphinx():
if self.is_type_sphinx() and self.run_default_commands:
return self.build_docs_class("sphinx_epub")
return False

Expand Down Expand Up @@ -744,6 +751,10 @@ def is_type_sphinx(self):
"""Is documentation type Sphinx."""
return "sphinx" in self.data.config.doctype

def is_type_mkdocs(self):
"""Is documentation type MkDocs."""
return "mkdocs" in self.data.config.doctype

def store_readthedocs_build_yaml(self):
# load YAML from user
yaml_path = os.path.join(
Expand Down