Skip to content

Build: log usage of old output directory _build/html #10038

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

Merged
merged 5 commits into from
Feb 23, 2023
Merged
Changes from 1 commit
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
19 changes: 19 additions & 0 deletions readthedocs/telemetry/collectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,27 @@ def collect(self):
},
}
data["doctool"] = self._get_doctool()

# NOTE: Check if there are files at `_build/html` (the old output directory)
# and log these projects so we can communicate with their maintainers
#
# This temporal and should be removed in the future once we have
# decided what to do with this collected data.
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably aren't as concerned about collecting this data as we are about saving user builds from having bad content. Anyone using doxygen and friends could have _build/html hardcoded, and will have silently broken docs.

self._check_using_old_output_directory()

return data

def _check_using_old_output_directory(self):
code, stdout, stderr = self.run(
"ls",
"_build/html",
cwd=self.project.checkout_path(self.version.slug),
)
if code == 0:
log.warning(
"Directory '_build/html' exists. This may lead to unexpected behavior."
Copy link
Contributor

Choose a reason for hiding this comment

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

We should raise something user facing as well. I'm still a huge +1 on better error/warning patterns, but would it make sense to set the Build.error here? If there is something in this path, that almost certainly mean the build will be missing content if we don't fail the build explicitly.

)

def _get_doctool_name(self):
if self.version.is_sphinx_type:
return "sphinx"
Expand Down