From 84fbf3ef6dd62edd799bcd7dd325c3cd047a85b3 Mon Sep 17 00:00:00 2001 From: Steven Clontz Date: Fri, 10 Nov 2023 15:33:55 -0600 Subject: [PATCH] skip targets with invalid publication files (#638) * skip targets with invalid publication files * formatting --- pretext/project/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pretext/project/__init__.py b/pretext/project/__init__.py index 314c6e68..6889dcff 100644 --- a/pretext/project/__init__.py +++ b/pretext/project/__init__.py @@ -1112,6 +1112,14 @@ class ProjectVersionOnly(pxml.BaseXmlModel, tag="project"): d = tgt.model_dump() del d["format"] + # Ensure publication file exists (necessary for v2 validation) + if not Path(tgt.publication).exists(): + log.warning( + f"Publication file at {tgt.publication} does not exist." + ) + log.warning(f"{tgt.name} will not be available.") + continue + # Remove the `None` from optional values, so the new format can replace these. for key in ("site", "xsl", "latex_engine"): if d[key] is None: