Skip to content

Commit

Permalink
Merge pull request #19 from UdK-VPT/issue18_timestamp
Browse files Browse the repository at this point in the history
add entries fullplatform, hostname, username and functions timestamp and infostamp
  • Loading branch information
jraedler authored Mar 25, 2019
2 parents cc50c4f + beb0761 commit 9312883
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
11 changes: 10 additions & 1 deletion CoTeTo/Controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
import os.path
import zipfile
import logging
import platform
import getpass
import time
import CoTeTo
from CoTeTo.Generator import Generator
from urllib.request import pathname2url


class Controller(object):

"""main controller of the code generation framework"""
Expand All @@ -29,9 +31,16 @@ def __init__(self, generatorPath=[], logger='CoTeTo', logHandler=None, logLevel=
self.logger.info('Starting CoTeTo.Controller from file %s, version %s', __file__, CoTeTo.__version__)
# create system configuration dict - will be available to subsystems
self.systemCfg = {
# static entries:
'platform': sys.platform,
'version': CoTeTo.__version__,
'path': os.path.dirname(os.path.realpath(__file__)),
'fullplatform': platform.platform(),
'hostname': platform.node(),
'username': getpass.getuser(),
# functions:
'timestamp': time.asctime,
'infostamp': lambda: '%s | %s@%s | %s | CoTeTo %s' % (time.asctime(), getpass.getuser(), platform.node(), platform.platform(), CoTeTo.__version__)
# need more here?
}
self.pathname2url = pathname2url
Expand Down
3 changes: 1 addition & 2 deletions Generators/TestCustomEntries/Templates/Main.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#
# CoTeTo
# Version: ${systemCfg['version']}
# Platform: ${systemCfg['platform']}
# Info: ${systemCfg['infostamp']()}
# Path: ${systemCfg['path']}
# Gen-Path: ${', '.join(systemCfg['generatorPath'])}
#
Expand Down
3 changes: 1 addition & 2 deletions Generators/TestJinja2/Templates/Main.jinja2
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#
# CoTeTo
# Version: {{systemCfg['version']}}
# Platform: {{systemCfg['platform']}}
# Info: {{systemCfg['infostamp']()}}
# Path: {{systemCfg['path']}}
# Gen-Path: {{', '.join(systemCfg['generatorPath'])}}
#
Expand Down
3 changes: 1 addition & 2 deletions Generators/TestMako/Templates/Main.mako
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#
# CoTeTo
# Version: ${systemCfg['version']}
# Platform: ${systemCfg['platform']}
# Info: ${systemCfg['infostamp']()}
# Path: ${systemCfg['path']}
# Gen-Path: ${', '.join(systemCfg['generatorPath'])}
#
Expand Down
3 changes: 1 addition & 2 deletions Generators/TestPostExec/Templates/Main.mako
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#
# CoTeTo
# Version: ${systemCfg['version']}
# Platform: ${systemCfg['platform']}
# Info: ${systemCfg['infostamp']()}
# Path: ${systemCfg['path']}
# Gen-Path: ${', '.join(systemCfg['generatorPath'])}
#
Expand Down

0 comments on commit 9312883

Please sign in to comment.