diff options
| author | Dominik Holland <dominik.holland@qt.io> | 2022-10-13 11:32:07 +0200 |
|---|---|---|
| committer | Dominik Holland <dominik.holland@qt.io> | 2022-10-18 09:34:51 +0200 |
| commit | f79cdbbaa6969fb3dd92748c7cda71ed0fc5746e (patch) | |
| tree | e0c549b14638683b39b09744be8215d4fe3eac47 /src/tools/ifcodegen/generate.py | |
| parent | bfdc561cc3ef050b312d40ed430801f0d5efe73a (diff) | |
ifcodegen: Add support to load extra jinja filters
In addition to allow a filters.py which can be part
of a custom template folder, there is now also a
way to load filters from other locations.
The extra_filters are configured in the generation
yaml file and can load files from other templates
or common folders within the template search path.
Fixes: QTBUG-107005
Change-Id: I518ff96659a3792fbb2a1d64ffc1d5c40eb69767
Reviewed-by: Robert Griebl <robert.griebl@qt.io>
Diffstat (limited to 'src/tools/ifcodegen/generate.py')
| -rwxr-xr-x | src/tools/ifcodegen/generate.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/ifcodegen/generate.py b/src/tools/ifcodegen/generate.py index 7e85b065..ad032438 100755 --- a/src/tools/ifcodegen/generate.py +++ b/src/tools/ifcodegen/generate.py @@ -88,6 +88,11 @@ def generate(template_search_paths, tplconfig, moduleConfig, annotations, import 'srcBase': srcBase } search_path = [tplconfig] + # In case tplconfig is a path, we also want to add the containing folder to the search-path + # This makes sure that also templates referenced by path can use common templates or commmon filters + if os.path.exists(tplconfig): + search_path += [os.path.dirname(tplconfig)] + search_path += template_search_paths generator = CustomRuleGenerator(search_path=search_path, destination=dst, context=ctx, modules=module_names) |
