From 1c116bf7dce8cadc6ba2b4f56f64a42cfbf5a91f Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 30 Jun 2024 01:24:48 +0100 Subject: [PATCH] Add data file dependencies --- source/generate-ninja.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source/generate-ninja.py b/source/generate-ninja.py index 8308ffb8..64d0af7c 100644 --- a/source/generate-ninja.py +++ b/source/generate-ninja.py @@ -64,12 +64,15 @@ def replace_ext(fn, new_ext): Rmd_chapters = quarto_conf['book']['chapters'] nb_dir = quarto_conf['noteout']['nb-dir'] -# Data files generated by notebook build -data_files = glob(f'data/*.csv') +# Data files needed to run output notebooks. +data_files = glob('data/*.csv') for lang in languages: + data_out_files = [] for data_file in data_files: - w.build(f'../{lang}-book/{nb_dir}/{data_file}', 'copy', data_file) + data_out_file = f'../{lang}-book/{nb_dir}/{data_file}' + w.build(data_out_file, 'copy', data_file) + data_out_files.append(data_out_file) for fmt in ('html', 'pdf'): # HTML builds use PNG images; PDF builds use PDF images @@ -96,7 +99,9 @@ def replace_ext(fn, new_ext): f'{lang}-book{target_postfix}', 'quarto-render-project', "", - implicit=[f'_quarto-{lang}.yml', 'simon_refs.bib'] + built_diagrams[image_fmt], + implicit=([f'_quarto-{lang}.yml', 'simon_refs.bib'] + + built_diagrams[image_fmt] + + data_out_files), variables={'lang': lang, 'format': fmt} )