From 47b2956ec3bec6b8687205ea56c4b46ab08756a0 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Tue, 1 Oct 2024 08:06:58 +0100 Subject: [PATCH] Set the ``state.toml`` filename based upon ``--select-output`` --- build_docs.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build_docs.py b/build_docs.py index 12c1319..377bbe5 100755 --- a/build_docs.py +++ b/build_docs.py @@ -929,7 +929,10 @@ def should_rebuild(self): return False def load_state(self) -> dict: - state_file = self.build_root / "state.toml" + if self.select_output is None: + state_file = self.build_root / "state.toml" + else: + state_file = self.build_root / f"state-{self.select_output}.toml" try: return tomlkit.loads(state_file.read_text(encoding="UTF-8"))[ f"/{self.language.tag}/{self.version.name}/" @@ -942,7 +945,10 @@ def save_state(self, build_start: dt, build_duration: float, trigger: str): Using this we can deduce if a rebuild is needed or not. """ - state_file = self.build_root / "state.toml" + if self.select_output is None: + state_file = self.build_root / "state.toml" + else: + state_file = self.build_root / f"state-{self.select_output}.toml" try: states = tomlkit.parse(state_file.read_text(encoding="UTF-8")) except FileNotFoundError: