| Trees | Indices | Help |
|---|
|
|
1 #============================================================================
2 #Name : templatebuilder.py
3 #Part of : Helium
4
5 #Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
6 #All rights reserved.
7 #This component and the accompanying materials are made available
8 #under the terms of the License "Eclipse Public License v1.0"
9 #which accompanies this distribution, and is available
10 #at the URL "http://www.eclipse.org/legal/epl-v10.html".
11 #
12 #Initial Contributors:
13 #Nokia Corporation - initial contribution.
14 #
15 #Contributors:
16 #
17 #Description:
18 #===============================================================================
19
20 """ The template builder. """
21 import logging
22
23 # Uncomment this line to enable logging in this module, or configure logging elsewhere
24 #logging.basicConfig(level=logging.INFO)
25 logger = logging.getLogger('integration.templatebuilder')
26
28 """ This class implements a template builder.
29 """
30
34
36 """ Render all the templates for the current product. """
37 for config in self._config.getConfigurations(self._product, 'TemplateBuilder'):
38 self._build_config(config)
39
41 """ Read the whole file content.
42 """
43 logger.info("Using template '%s'..." % config['template.file'])
44 ftr = open(config['template.file'], "r")
45 content = ftr.read()
46 ftr.close()
47 return content
48
49
51 """ Open config and render the template. """
52 if config.name != None:
53 logger.info("Building config '%s'..." % config.name)
54 logger.info("Creating file '%s'..." % config['output.file'])
55 output = open(config['output.file'], 'w+')
56 output.write(config.interpolate(self.__read_template(config)))
57 output.close()
58
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Wed Sep 09 13:44:21 2009 | http://epydoc.sourceforge.net |