From b4739fd1be37d2841c6c284a28036dfbc7646692 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Wed, 16 Mar 2022 13:04:02 +0100 Subject: [PATCH] Build director: define the environment just once for a set of cmds --- readthedocs/doc_builder/director.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/readthedocs/doc_builder/director.py b/readthedocs/doc_builder/director.py index 8f690994202..75479a77148 100644 --- a/readthedocs/doc_builder/director.py +++ b/readthedocs/doc_builder/director.py @@ -298,11 +298,12 @@ def run_build_job(self, job): return cwd = self.data.project.checkout_path(self.data.version.slug) + environment = self.vcs_environment + if job not in ("pre_checkout", "post_checkout"): + environment = self.build_environment + commands = getattr(self.data.config.build.jobs, job, []) for command in commands: - environment = self.vcs_environment - if job not in ("pre_checkout", "post_checkout"): - environment = self.build_environment environment.run(*command.split(), escape_command=False, cwd=cwd) # Helpers