Skip to content

Commit 7f6c098

Browse files
committed
Hack the Environment logs to avoid fails because no version
1 parent c6425b9 commit 7f6c098

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

readthedocs/doc_builder/environments.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,13 @@ def __init__(self, project, environment=None):
287287
def record_command(self, command):
288288
pass
289289

290+
def _log_warn_only(self, msg):
291+
log.warn(LOG_TEMPLATE.format(
292+
project=self.project.slug,
293+
version='latest',
294+
msg=msg,
295+
))
296+
290297
def run(self, *cmd, **kwargs):
291298
"""Shortcut to run command from environment."""
292299
return self.run_command_class(cls=self.command_class, cmd=cmd, **kwargs)
@@ -332,11 +339,7 @@ def run_command_class(self, cls, cmd, warn_only=False, **kwargs):
332339
msg += u':\n{out}'.format(out=build_cmd.output)
333340

334341
if warn_only:
335-
# TODO: remove version dependency to log here
336-
log.warn(LOG_TEMPLATE
337-
.format(project=self.project.slug,
338-
version=self.version.slug,
339-
msg=msg))
342+
self._log_warn_only(msg)
340343
else:
341344
raise BuildEnvironmentWarning(msg)
342345
return build_cmd
@@ -434,6 +437,14 @@ def record_command(self, command):
434437
if self.record:
435438
command.save()
436439

440+
def _log_warn_only(self, msg):
441+
# :'(
442+
log.warn(LOG_TEMPLATE.format(
443+
project=self.project.slug,
444+
version=self.version.slug,
445+
msg=msg,
446+
))
447+
437448
def run(self, *cmd, **kwargs):
438449
kwargs.update({
439450
'build_env': self,

0 commit comments

Comments
 (0)