-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from UdK-VPT/issue16_postexec
Issue16 postexec
- Loading branch information
Showing
7 changed files
with
107 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# a filter function is called with the following arguments: | ||
# d - the data dictionary read from the loader | ||
# systemCfg - system configuration | ||
# generatorCfg - generator configuration | ||
# logger - a logger instance | ||
|
||
|
||
def filter01(d, systemCfg, generatorCfg, logger): | ||
|
||
# spread a message | ||
logger.debug('hi there! This is a filter running from module: ' + __file__) | ||
|
||
x = d['dummy'] | ||
|
||
# manipulate some data | ||
x['foo'] += 1 | ||
|
||
# add more data | ||
x['bar'] = 2.0 * x['foo'] | ||
|
||
# no return needed - data is manipulated inplace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[GENERATOR] | ||
name = TestPostExec | ||
version = 0.1 | ||
description = test the post execution feature | ||
author = Joerg Raedler [email protected] | ||
|
||
[LOADER] | ||
name = TestDummy | ||
minVer = 0.1 | ||
maxVer = 2.0 | ||
|
||
[FILTER] | ||
module = Filter01 | ||
function = filter01 | ||
|
||
[TEMPLATE] | ||
topFile = Main.mako | ||
type = mako | ||
# be VERY carefull with the postexec feature, it has complete access | ||
# to the whole namespace and will run this code without checking! | ||
# You can use "fname" to access the name of the generated file | ||
postExec = os.system("dir "+fname) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# | ||
# CoTeTo | ||
# Version: ${systemCfg['version']} | ||
# Platform: ${systemCfg['platform']} | ||
# Path: ${systemCfg['path']} | ||
# Gen-Path: ${', '.join(systemCfg['generatorPath'])} | ||
# | ||
# Generator | ||
# Name: ${generatorCfg['GENERATOR'].get('name')} | ||
# Version: ${generatorCfg['GENERATOR'].get('version')} | ||
|
||
The value of foo is ${d['dummy']['foo']}. | ||
|
||
<%include file="Sub.mako"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Hello, I'm a sub template! | ||
bar = ${d['dummy']['bar']} |