|
10 | 10 | import os
|
11 | 11 | import tarfile
|
12 | 12 |
|
13 |
| -import pytz |
14 | 13 | import structlog
|
15 | 14 | import yaml
|
16 | 15 | from django.conf import settings
|
17 |
| -from django.utils import timezone |
18 | 16 | from django.utils.translation import gettext_lazy as _
|
19 | 17 |
|
20 | 18 | from readthedocs.builds.constants import EXTERNAL
|
@@ -249,47 +247,18 @@ def checkout(self):
|
249 | 247 | self.data.build["config"] = self.data.config.as_dict()
|
250 | 248 | self.data.build["readthedocs_yaml_path"] = custom_config_file
|
251 | 249 |
|
252 |
| - now = timezone.now() |
253 |
| - pdt = pytz.timezone("America/Los_Angeles") |
254 |
| - |
255 |
| - # fmt: off |
256 |
| - # These browndates matches https://blog.readthedocs.com/use-build-os-config/ |
257 |
| - browndates = any([ |
258 |
| - timezone.datetime(2023, 7, 14, 0, 0, 0, tzinfo=pdt) < now < timezone.datetime(2023, 7, 14, 12, 0, 0, tzinfo=pdt), # First, 12hs |
259 |
| - timezone.datetime(2023, 8, 14, 0, 0, 0, tzinfo=pdt) < now < timezone.datetime(2023, 8, 15, 0, 0, 0, tzinfo=pdt), # Second, 24hs |
260 |
| - timezone.datetime(2023, 9, 4, 0, 0, 0, tzinfo=pdt) < now < timezone.datetime(2023, 9, 6, 0, 0, 0, tzinfo=pdt), # Third, 24hs |
261 |
| - timezone.datetime(2023, 9, 25, 0, 0, 0, tzinfo=pdt) < now, # Fully removal |
262 |
| - ]) |
263 |
| - # fmt: on |
264 |
| - |
265 | 250 | # Raise a build error if the project is not using a config file or using v1
|
266 |
| - if ( |
267 |
| - settings.RTD_ENFORCE_BROWNOUTS_FOR_DEPRECATIONS |
268 |
| - and browndates |
269 |
| - and self.data.config.version not in ("2", 2) |
270 |
| - ): |
| 251 | + if self.data.config.version not in ("2", 2): |
271 | 252 | raise BuildUserError(BuildUserError.NO_CONFIG_FILE_DEPRECATED)
|
272 | 253 |
|
273 | 254 | # Raise a build error if the project is using "build.image" on their config file
|
| 255 | + build_config_key = self.data.config.source_config.get("build", {}) |
| 256 | + if "image" in build_config_key: |
| 257 | + raise BuildUserError(BuildUserError.BUILD_IMAGE_CONFIG_KEY_DEPRECATED) |
274 | 258 |
|
275 |
| - # fmt: off |
276 |
| - # These browndates matches https://blog.readthedocs.com/use-build-os-config/ |
277 |
| - browndates = any([ |
278 |
| - timezone.datetime(2023, 8, 28, 0, 0, 0, tzinfo=pdt) < now < timezone.datetime(2023, 8, 28, 12, 0, 0, tzinfo=pdt), # First, 12hs |
279 |
| - timezone.datetime(2023, 9, 18, 0, 0, 0, tzinfo=pdt) < now < timezone.datetime(2023, 9, 19, 0, 0, 0, tzinfo=pdt), # Second, 24hs |
280 |
| - timezone.datetime(2023, 10, 2, 0, 0, 0, tzinfo=pdt) < now < timezone.datetime(2023, 10, 4, 0, 0, 0, tzinfo=pdt), # Third, 48hs |
281 |
| - timezone.datetime(2023, 10, 16, 0, 0, 0, tzinfo=pdt) < now, # Fully removal |
282 |
| - ]) |
283 |
| - # fmt: on |
284 |
| - |
285 |
| - if settings.RTD_ENFORCE_BROWNOUTS_FOR_DEPRECATIONS and browndates: |
286 |
| - build_config_key = self.data.config.source_config.get("build", {}) |
287 |
| - if "image" in build_config_key: |
288 |
| - raise BuildUserError(BuildUserError.BUILD_IMAGE_CONFIG_KEY_DEPRECATED) |
289 |
| - |
290 |
| - # TODO: move this validation to the Config object once we are settled here |
291 |
| - if "image" not in build_config_key and "os" not in build_config_key: |
292 |
| - raise BuildUserError(BuildUserError.BUILD_OS_REQUIRED) |
| 259 | + # TODO: move this validation to the Config object once we are settled here |
| 260 | + if "image" not in build_config_key and "os" not in build_config_key: |
| 261 | + raise BuildUserError(BuildUserError.BUILD_OS_REQUIRED) |
293 | 262 |
|
294 | 263 | if self.vcs_repository.supports_submodules:
|
295 | 264 | self.vcs_repository.update_submodules(self.data.config)
|
|
0 commit comments