-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
fix(build): raise clear error if mkdocs.yml config file is missing #12378
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
Open
RabbitAlbatross
wants to merge
22
commits into
readthedocs:main
Choose a base branch
from
RabbitAlbatross:fix-mkdocs-error-message
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+68
−72
Open
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1c5b771
fix(build): raise clear error if mkdocs.yml config file is missing
RabbitAlbatross 364220e
fix import order to satisfy Ruff
RabbitAlbatross 16fea11
Update mkdocs.py
RabbitAlbatross 354cff2
Update exceptions.py
RabbitAlbatross 032a0bb
Update notifications.py
RabbitAlbatross b0837a9
Update mkdocs.py
RabbitAlbatross ded0110
Fixing minor mistake in import of mkdocs.py
RabbitAlbatross f5900ce
yaml import problem fixed
RabbitAlbatross fb74071
Update readthedocs/projects/exceptions.py
RabbitAlbatross 1307ed8
Update mkdocs.py
RabbitAlbatross be69532
Update mkdocs.py
RabbitAlbatross a2583ca
Update mkdocs.py
RabbitAlbatross e0a28e4
Update notifications.py
RabbitAlbatross 138494a
Update notifications.py
RabbitAlbatross 3565a49
Update test_build_tasks.py
RabbitAlbatross 887bd3c
Update test_build_tasks.py
RabbitAlbatross 4e5fc07
Update mkdocs.py
RabbitAlbatross 690a8b0
Update exceptions.py
RabbitAlbatross dab05b7
Update notifications.py
RabbitAlbatross fcacffa
Update test_build_tasks.py
RabbitAlbatross c59c0f9
Update mkdocs.py
RabbitAlbatross f767c43
Update exceptions.py
RabbitAlbatross File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,15 +5,17 @@ | |
""" | ||
|
||
import os | ||
|
||
import structlog | ||
import yaml | ||
from django.conf import settings | ||
|
||
from readthedocs.core.utils.filesystem import safe_open | ||
from readthedocs.doc_builder.base import BaseBuilder | ||
from readthedocs.doc_builder.exceptions import BuildUserError | ||
from readthedocs.projects.constants import MKDOCS | ||
from readthedocs.projects.constants import MKDOCS_HTML | ||
from readthedocs.projects.exceptions import ProjectConfigurationError | ||
|
||
|
||
|
||
log = structlog.get_logger(__name__) | ||
|
@@ -45,6 +47,8 @@ def __init__(self, *args, **kwargs): | |
|
||
# This is the *MkDocs* yaml file | ||
self.yaml_file = self.get_yaml_config() | ||
if not os.path.exists(self.yaml_file): | ||
raise ProjectConfigurationError(ProjectConfigurationError.MKDOCS_NOT_FOUND) | ||
|
||
def get_final_doctype(self): | ||
""" | ||
|
@@ -99,6 +103,10 @@ def build(self): | |
"--config-file", | ||
os.path.relpath(self.yaml_file, self.project_path), | ||
] | ||
|
||
if not os.path.exists(self.yaml_file): | ||
raise ProjectConfigurationError(ProjectConfigurationError.NOT_FOUND) | ||
humitos marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
|
||
if self.config.mkdocs.fail_on_warning: | ||
build_command.append("--strict") | ||
cmd_ret = self.run( | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this here.