summaryrefslogtreecommitdiff
path: root/subplot.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-05-02 08:56:41 +0300
committerLars Wirzenius <liw@liw.fi>2020-05-02 17:04:16 +0300
commit06fa437f6f7d38fc10099f6092481f10e22535f1 (patch)
tree857c67d7a35854838b98090374ccc484b825a092 /subplot.py
parent5c12f2dc5c4b3d1794d0c3cabc50cef700ca78e1 (diff)
downloadsubplot-06fa437f6f7d38fc10099f6092481f10e22535f1.tar.gz
Change: produce docgen output if missing or older than any source
Source files are: * the markdown file * the bindings, functions, and bibliography files listed in YAML metadata * any included images in the markdown The template file is not considered: it's only relevant for codegen. The docgen binary is not considered, either, for now, because reliably finding the binary is difficult.
Diffstat (limited to 'subplot.py')
-rw-r--r--subplot.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/subplot.py b/subplot.py
index 45a5a45..2b9998f 100644
--- a/subplot.py
+++ b/subplot.py
@@ -14,6 +14,9 @@ def touch_file(
ts = time.mktime(t)
os.utime(filename, times=(ts, ts))
+def update_mtime(ctx, filename=None):
+ os.utime(filename)
+
def try_docgen(ctx, md=None, output=None):
docgen = binary('sp-docgen')
runcmd(ctx, [docgen, md, '-o', output])
@@ -113,6 +116,9 @@ def remember_metadata(ctx, filename=None):
def has_same_metadata_as_remembered(ctx, filename=None):
assert_eq(ctx['remembered-metadata'], _get_metadata(filename))
+def has_diff_metadata_than_remembered(ctx, filename=None):
+ assert_ne(ctx['remembered-metadata'], _get_metadata(filename))
+
def only_these_files_exist(ctx, filenames=None):
filenames = filenames.replace(',', '').split()
assert_eq(set(os.listdir('.')), set(filenames))