|
16 | 16 | from django.utils.translation import gettext_lazy as _
|
17 | 17 |
|
18 | 18 | from readthedocs.builds.constants import EXTERNAL
|
| 19 | +from readthedocs.config.config import CONFIG_FILENAME_REGEX |
| 20 | +from readthedocs.config.find import find_one |
19 | 21 | from readthedocs.core.utils.filesystem import safe_open
|
20 | 22 | from readthedocs.doc_builder.config import load_yaml_config
|
21 | 23 | from readthedocs.doc_builder.exceptions import BuildUserError
|
@@ -108,20 +110,6 @@ def setup_vcs(self):
|
108 | 110 | # self.run_build_job("pre_checkout")
|
109 | 111 | self.checkout()
|
110 | 112 |
|
111 |
| - # Output the path for the config file used. |
112 |
| - # This works as confirmation for us & the user about which file is used, |
113 |
| - # as well as the fact that *any* config file is used. |
114 |
| - if self.data.config.source_file: |
115 |
| - cwd = self.data.project.checkout_path(self.data.version.slug) |
116 |
| - command = self.vcs_environment.run( |
117 |
| - "cat", |
118 |
| - # Show user the relative path to the config file |
119 |
| - # TODO: Have our standard path replacement code catch this. |
120 |
| - # https://github.com/readthedocs/readthedocs.org/pull/10413#discussion_r1230765843 |
121 |
| - self.data.config.source_file.replace(cwd + "/", ""), |
122 |
| - cwd=cwd, |
123 |
| - ) |
124 |
| - |
125 | 113 | self.run_build_job("post_checkout")
|
126 | 114 |
|
127 | 115 | commit = self.data.build_commit or self.vcs_repository.commit
|
@@ -240,6 +228,25 @@ def checkout(self):
|
240 | 228 |
|
241 | 229 | if custom_config_file:
|
242 | 230 | log.info("Using a custom .readthedocs.yaml file.", path=custom_config_file)
|
| 231 | + |
| 232 | + checkout_path = self.data.project.checkout_path(self.data.version.slug) |
| 233 | + default_config_file = find_one(checkout_path, CONFIG_FILENAME_REGEX) |
| 234 | + |
| 235 | + # Output the path for the config file used. |
| 236 | + # This works as confirmation for us & the user about which file is used, |
| 237 | + # as well as the fact that *any* config file is used. |
| 238 | + if custom_config_file or default_config_file: |
| 239 | + command = self.vcs_environment.run( |
| 240 | + "cat", |
| 241 | + # Show user the relative path to the config file |
| 242 | + # TODO: Have our standard path replacement code catch this. |
| 243 | + # https://github.com/readthedocs/readthedocs.org/pull/10413#discussion_r1230765843 |
| 244 | + (custom_config_file or default_config_file).replace( |
| 245 | + checkout_path + "/", "" |
| 246 | + ), |
| 247 | + cwd=checkout_path, |
| 248 | + ) |
| 249 | + |
243 | 250 | self.data.config = load_yaml_config(
|
244 | 251 | version=self.data.version,
|
245 | 252 | readthedocs_yaml_path=custom_config_file,
|
|
0 commit comments