aboutsummaryrefslogtreecommitdiff
path: root/tools/interface_generator/bin/templates.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/interface_generator/bin/templates.py')
-rw-r--r--tools/interface_generator/bin/templates.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/interface_generator/bin/templates.py b/tools/interface_generator/bin/templates.py
index d6a6bb5..9f7539e 100644
--- a/tools/interface_generator/bin/templates.py
+++ b/tools/interface_generator/bin/templates.py
@@ -4,9 +4,16 @@ from pathlib import Path
import re
-def get_templates(path: Path):
+TEMPLATE_PATTERN = re.compile(r"^[^_]\S+\.mako$")
+
+
+def get_templates_dir(name="templates") -> Path:
+ """get the templates directory"""
+ return Path(__file__).parent / name
+
+
+def get_templates(path: Path) -> list[Path]:
"""list templates in given path"""
- template_pattern = re.compile(r"^[^_]\S+\.mako$")
result = list(path.glob("*.mako"))
- result = [item for item in result if template_pattern.match(item.name)]
+ result = [item for item in result if TEMPLATE_PATTERN.match(item.name)]
return result