summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--repo/www/Makefile2
-rwxr-xr-xrepo/www/make-deps.py27
2 files changed, 21 insertions, 8 deletions
diff --git a/repo/www/Makefile b/repo/www/Makefile
index 6bc53ea..ca50752 100644
--- a/repo/www/Makefile
+++ b/repo/www/Makefile
@@ -16,7 +16,7 @@ dependencies = deps.mk
include $(dependencies)
$(dependencies): make-deps.py $(text_folders)
- python3 $< $(TOP_DIR) $(OUT_DIR)
+ python3 $< "$(TEXT_FILES)" $(TOP_DIR) $(OUT_DIR)
site: $(pages)
diff --git a/repo/www/make-deps.py b/repo/www/make-deps.py
index 26a4037..189ccfd 100755
--- a/repo/www/make-deps.py
+++ b/repo/www/make-deps.py
@@ -32,16 +32,29 @@ class Directory:
def parse_arguments(args):
- if len(args) != 3:
- exit(f'Usage: {argv[0]} TOP-DIR OUTPUT-DIR')
+ if len(args) != 4:
+ exit(f'Usage: {argv[0]} EXTENSIONS TOP-DIR OUTPUT-DIR')
- return argv[1], argv[2]
+ return argv[1].split(), argv[2], argv[3]
-def find_sources(top_dir):
+def join(collections, joiner):
+ out = []
+
+ for c in collections[:-1]:
+ out.extend(c)
+ out.append(joiner)
+
+ out.extend(collections[-1])
+ return tuple(out)
+
+
+def find_sources(extensions, top_dir):
+ filters = tuple(('-name', '*.'+ext) for ext in extensions)
+
p = run(
# TODO: use git ls-files
- ('find', top_dir, '-name', '*.md', '-o', '-name', '*.org'),
+ ('find', top_dir) + join(filters, '-o'),
capture_output=True, check=True, text=True
)
@@ -95,8 +108,8 @@ def write_dependencies(deps, directories, top_dir, out_dir):
def main(arguments):
- top_dir, out_dir = parse_arguments(arguments)
- source_files = find_sources(top_dir)
+ extensions, top_dir, out_dir = parse_arguments(arguments)
+ source_files = find_sources(extensions, top_dir)
directories = compute_directories(source_files, top_dir)