From 9388658ecb7343f369751c9958aa16c18099f0bf Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 16 Feb 2023 09:40:02 +0100 Subject: [PATCH 1/4] 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 --- readthedocs/telemetry/collectors.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/readthedocs/telemetry/collectors.py b/readthedocs/telemetry/collectors.py index 05cba855bf1..d24092a7603 100644 --- a/readthedocs/telemetry/collectors.py +++ b/readthedocs/telemetry/collectors.py @@ -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. + 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." + ) + def _get_doctool_name(self): if self.version.is_sphinx_type: return "sphinx" From dbb31eb27a6f5b0046470d284766934816c91ee7 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 23 Feb 2023 18:00:55 +0100 Subject: [PATCH 2/4] Build: use "test" command --- readthedocs/telemetry/collectors.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readthedocs/telemetry/collectors.py b/readthedocs/telemetry/collectors.py index d24092a7603..e489149ea08 100644 --- a/readthedocs/telemetry/collectors.py +++ b/readthedocs/telemetry/collectors.py @@ -104,7 +104,8 @@ def collect(self): def _check_using_old_output_directory(self): code, stdout, stderr = self.run( - "ls", + "test", + "-x", "_build/html", cwd=self.project.checkout_path(self.version.slug), ) From 1ef0a87e8772ee9b31562441e5b5d09b9de23ade Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 23 Feb 2023 18:01:38 +0100 Subject: [PATCH 3/4] Lint --- readthedocs/telemetry/collectors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs/telemetry/collectors.py b/readthedocs/telemetry/collectors.py index e489149ea08..72fb1a6c306 100644 --- a/readthedocs/telemetry/collectors.py +++ b/readthedocs/telemetry/collectors.py @@ -103,7 +103,7 @@ def collect(self): return data def _check_using_old_output_directory(self): - code, stdout, stderr = self.run( + code, _, stderr = self.run( "test", "-x", "_build/html", From 5930761010658387cb7e3375af226060e916c84d Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Thu, 23 Feb 2023 19:02:52 +0100 Subject: [PATCH 4/4] Lint --- readthedocs/telemetry/collectors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readthedocs/telemetry/collectors.py b/readthedocs/telemetry/collectors.py index 72fb1a6c306..8c3b2237034 100644 --- a/readthedocs/telemetry/collectors.py +++ b/readthedocs/telemetry/collectors.py @@ -103,7 +103,7 @@ def collect(self): return data def _check_using_old_output_directory(self): - code, _, stderr = self.run( + code, _, _ = self.run( "test", "-x", "_build/html",