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

Allow build mkdocs outside root #5539

Merged
Merged
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: 2 additions & 7 deletions readthedocs/doc_builder/backends/mkdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ class BaseMkdocs(BaseBuilder):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.yaml_file = self.get_yaml_config()
self.old_artifact_path = os.path.join(
self.version.project.checkout_path(self.version.slug),
os.path.dirname(self.yaml_file),
self.build_dir,
)
self.root_path = self.version.project.checkout_path(self.version.slug)
self.yaml_file = self.get_yaml_config()

# README: historically, the default theme was ``readthedocs`` but in
# https://github.com/rtfd/readthedocs.org/pull/4556 we change it to
Expand All @@ -76,8 +76,6 @@ def get_yaml_config(self):
self.project.checkout_path(self.version.slug),
'mkdocs.yml',
)
if not os.path.exists(mkdoc_path):
return None
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was removed to keep compatibility (see the 2nd commit message)

return mkdoc_path

def load_yaml_config(self):
Expand Down Expand Up @@ -112,9 +110,6 @@ def append_conf(self, **__):
:raises: ``MkDocsYAMLParseError`` if failed due to known type errors
(i.e. expecting a list and a string is found).
"""
if not self.yaml_file:
self.yaml_file = os.path.join(self.root_path, 'mkdocs.yml')

Copy link
Member Author

@stsewd stsewd Mar 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user_config = self.load_yaml_config()

# Handle custom docs dirs
Expand Down