diff --git a/CHANGELOG.md b/CHANGELOG.md index 45002d1..3a3a26a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning][]. ### Fixes - Remove vendored `hiyapyco` code since required changes were released upstream in v0.7.0 ([#45](https://github.com/Boehringer-Ingelheim/dso/pull/45)). - `None` values in `params.in.yaml` can now be used to override anything, e.g. to disable watermarking only in a specific stage ([#45](https://github.com/Boehringer-Ingelheim/dso/pull/45)). +- Clean up existing `*.rmarkdown` files in quarto stage before running `quarto render`. This fixes issues with re-running quarto stages that failed in the previous attempt ([#57](https://github.com/Boehringer-Ingelheim/dso/pull/57)). - DSO now respects a `DSO_SKIP_CHECK_ASK_PRE_COMMIT` environment variable. If it is set to anything that evaluates as `True`, we skip the check if pre-commit is installed. This was a requirement introduced by the R API package, see [#50](https://github.com/Boehringer-Ingelheim/dso/issues/50) ([#58](https://github.com/Boehringer-Ingelheim/dso/pull/58)). diff --git a/src/dso/exec.py b/src/dso/exec.py index b474232..18338b5 100644 --- a/src/dso/exec.py +++ b/src/dso/exec.py @@ -29,6 +29,16 @@ def _render_quarto(quarto_dir: Path, report_dir: Path, before_script: str, cwd: before_script = indent(before_script, " " * 8) report_dir = report_dir.absolute() report_dir.mkdir(exist_ok=True) + + # clean up existing `.rmarkdown` files that may interfere with rendering + # these are leftovers from a previous, failed `quarto render` attempt. If they still exist, the next attempt + # fails. We remove them *before* the run instead of cleaning them up *after* the run, because they + # may be usefule for debugging failures. + # see https://github.com/Boehringer-Ingelheim/dso/issues/54 + for f in quarto_dir.glob("*.rmarkdown"): + if f.is_file(): + f.unlink() + pandocfilter = "--filter dso_pandocfilter" if with_pandocfilter else "" # propagate quiet setting to quarto quiet = "--quiet" if bool(int(os.environ.get("DSO_QUIET", 0))) else ""