Skip to content

Commit d499203

Browse files
authored
Build: log usage of old output directory _build/html (#10038)
* Build: log usage of old output directory `_build/html` We have changed the output directory from `_build/html` to `$READTHEDOCS_OUTPUT/html` in the last few weeks. However, there are some projects that may have `_build/html` directory hardcoded in different places (e.g. `conf.py`). We want to log these projects and contact them to communicate this situation. Ideally, we should show a warning in the build detail's page, but I don't think we currently have a way to display a warning message. We only support error messages in this page. Related #10036 * Build: use "test" command * Lint
1 parent c0c3f02 commit d499203

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

readthedocs/telemetry/collectors.py

+20
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,28 @@ def collect(self):
9292
},
9393
}
9494
data["doctool"] = self._get_doctool()
95+
96+
# NOTE: Check if there are files at `_build/html` (the old output directory)
97+
# and log these projects so we can communicate with their maintainers
98+
#
99+
# This temporal and should be removed in the future once we have
100+
# decided what to do with this collected data.
101+
self._check_using_old_output_directory()
102+
95103
return data
96104

105+
def _check_using_old_output_directory(self):
106+
code, _, _ = self.run(
107+
"test",
108+
"-x",
109+
"_build/html",
110+
cwd=self.project.checkout_path(self.version.slug),
111+
)
112+
if code == 0:
113+
log.warning(
114+
"Directory '_build/html' exists. This may lead to unexpected behavior."
115+
)
116+
97117
def _get_doctool_name(self):
98118
if self.version.is_sphinx_type:
99119
return "sphinx"

0 commit comments

Comments
 (0)