|
39 | 39 | from readthedocs.notifications.models import Notification as NewNotification
|
40 | 40 | from readthedocs.projects import constants
|
41 | 41 | from readthedocs.projects.exceptions import ProjectConfigurationError
|
| 42 | +from readthedocs.doc_builder.exceptions import MkDocsYAMLParseError |
42 | 43 | from readthedocs.projects.managers import HTMLFileManager
|
43 | 44 | from readthedocs.projects.querysets import (
|
44 | 45 | ChildRelatedProjectQuerySet,
|
@@ -971,12 +972,31 @@ def conf_file(self, version=LATEST):
|
971 | 972 | )
|
972 | 973 |
|
973 | 974 | raise ProjectConfigurationError(ProjectConfigurationError.NOT_FOUND)
|
| 975 | + |
| 976 | + |
| 977 | + def yaml_file(self, version=LATEST): |
| 978 | + """Find a mkdocs ``mkdocs.yml`` file in the project checkout.""" |
| 979 | + files = self.find("mkdocs.yml", version) |
| 980 | + if not files: |
| 981 | + files = self.full_find("mkdocs.yml", version) |
| 982 | + if len(files) == 1: |
| 983 | + return files[0] |
| 984 | + ## TODO Handle for multiple Files |
| 985 | + |
| 986 | + raise MkDocsYAMLParseError(MkDocsYAMLParseError.NOT_FOUND) |
974 | 987 |
|
975 | 988 | def conf_dir(self, version=LATEST):
|
976 | 989 | conf_file = self.conf_file(version)
|
977 | 990 | if conf_file:
|
978 | 991 | return os.path.dirname(conf_file)
|
979 | 992 |
|
| 993 | + def yaml_dir(self, version=LATEST): |
| 994 | + conf_file = self.conf_file(version) |
| 995 | + if conf_file: |
| 996 | + return os.path.dirname(conf_file) |
| 997 | + |
| 998 | + |
| 999 | + |
980 | 1000 | @property
|
981 | 1001 | def has_good_build(self):
|
982 | 1002 | # Check if there is `_good_build` annotation in the Queryset.
|
|
0 commit comments