Changeset 8729
- Timestamp:
- 02/18/09 16:22:54 (4 years ago)
- Location:
- ossiedev/branches/0.7.x/tools
- Files:
-
- 2 removed
- 9 modified
- 1 copied
-
WaveDev/wavedev.cfg (modified) (1 diff)
-
WaveDev/wavedev/ComponentFrame.py (modified) (3 diffs)
-
WaveDev/wavedev/MainFrame.py (modified) (3 diffs)
-
WaveDev/wavedev/cfg.py (modified) (1 diff)
-
WaveDev/wavedev/generate/LICENSE (deleted)
-
WaveDev/wavedev/generate/genNode.py (modified) (8 diffs)
-
WaveDev/wavedev/generate/generic_preamble (copied) (copied from ossiedev/trunk/tools/WaveDev/wavedev/generate/generic_preamble)
-
WaveDev/wavedev/generate/gpl_preamble (deleted)
-
WaveDev/wavedev/generate/templates/basic_ports/genStructure.py (modified) (10 diffs)
-
WaveDev/wavedev/generate/templates/custom_ports/genStructure.py (modified) (9 diffs)
-
WaveDev/wavedev/generate/templates/py_comp/genStructure.py (modified) (6 diffs)
-
setup.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/branches/0.7.x/tools/WaveDev/wavedev.cfg
r5885 r8729 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <owdconfiguration> 3 <version>Beta Version 0. 6.2</version>3 <version>Beta Version 0.7.2</version> 4 4 <installpath>/sdr</installpath> 5 5 <stdidlpath></stdidlpath> 6 6 <ossieincludepath></ossieincludepath> 7 7 <homedir></homedir> 8 <sourcepreamble></sourcepreamble> 9 <licensefile></licensefile> 10 <developer></developer> 8 11 </owdconfiguration> -
ossiedev/branches/0.7.x/tools/WaveDev/wavedev/ComponentFrame.py
r8170 r8729 31 31 import cPickle 32 32 import PropertiesDialog 33 import MainFrame33 import cfg 34 34 import string 35 35 … … 353 353 self.menuComponent.Enable(wxID_COMPFRAMEMENUCOMPONENTGENERATE,True) 354 354 self.compDescrBox.Enable(True) 355 MainFrame.LoadConfiguration(self)355 cfg.LoadConfiguration(self) 356 356 else: 357 357 self.menuComponent.Enable(wxID_COMPFRAMEMENUCOMPONENTGENERATE,False) … … 1028 1028 shutil.copy(self.wavedevPath + '/generate/reconf',self.path) 1029 1029 os.chmod(self.path + '/reconf', 0755) 1030 shutil.copy(self.wavedevPath + '/generate/LICENSE',self.path) 1030 if self.licensefile != "": 1031 shutil.copy(self.licensefile,self.path + '/LICENSE') 1031 1032 1032 1033 if self.active_comp.timing: -
ossiedev/branches/0.7.x/tools/WaveDev/wavedev/MainFrame.py
r8260 r8729 31 31 import importNode 32 32 import NodeDialog 33 import xml.dom.minidom33 import cfg 34 34 from xml.dom.minidom import Node 35 35 import generate.genNode as genNode … … 463 463 464 464 #read in the configuration information 465 LoadConfiguration(self)465 cfg.LoadConfiguration(self) 466 466 467 467 #setup the environment … … 2062 2062 cid1 = self.nodeBox.GetNextSibling(cid1) 2063 2063 2064 ###############################################################################2065 ## LoadConfiguration2066 ## This function is not a part of the frame class so that other modules can2067 ## call it2068 ###############################################################################2069 def LoadConfiguration(frame_obj):2070 '''Extracts information from configuration file'''2071 root = __file__2072 if os.path.islink (root):2073 root = os.path.realpath (root)2074 root = os.path.dirname (os.path.abspath (root))2075 2076 doc_cfg = xml.dom.minidom.parse(root + '/../wavedev.cfg')2077 2078 # version2079 try:2080 frame_obj.version = \2081 str(doc_cfg.getElementsByTagName("version")[0].firstChild.data)2082 except:2083 frame_obj.version = "unknown"2084 2085 # install path2086 try:2087 frame_obj.installPath = \2088 str(doc_cfg.getElementsByTagName("installpath")[0].firstChild.data)2089 if frame_obj.installPath[len(frame_obj.installPath)-1] != '/':2090 frame_obj.installPath = frame_obj.installPath + '/'2091 except:2092 frame_obj.installPath = ""2093 2094 # standard IDL path2095 use_default_stdidlpath = False2096 try:2097 frame_obj.stdIdlPath = str(doc_cfg.getElementsByTagName("stdidlpath")[0].firstChild.data)2098 except:2099 frame_obj.stdIdlPath = ""2100 if len(frame_obj.stdIdlPath) > 0:2101 if frame_obj.stdIdlPath[len(frame_obj.stdIdlPath)-1] != '/':2102 frame_obj.stdIdlPath = frame_obj.stdIdlPath + '/'2103 # see if directory actually exists2104 if not os.path.isdir(frame_obj.stdIdlPath):2105 print "warning: wavedev.cfg stdidl path " + frame_obj.stdIdlPath + " does not exist"2106 print " => using default standard idl path instead"2107 use_default_stdidlpath = True2108 else:2109 use_default_stdidlpath = True2110 2111 if use_default_stdidlpath:2112 if os.path.isdir("/usr/include/standardinterfaces"):2113 frame_obj.stdIdlPath = "/usr/include/standardinterfaces/"2114 elif os.path.isdir("/usr/local/include/standardinterfaces"):2115 frame_obj.stdIdlPath = "/usr/local/include/standardinterfaces/"2116 else:2117 tmpstr = "StandardInterfaces does not appear to be installed!\n"2118 tmpstr += "You will not be able to add ports to components.\n\n"2119 tmpstr += "If you have standardinterfaces installed in a location\n"2120 tmpstr += "other than the default, please specify that location\n"2121 tmpstr += "in the wavedev.cfg file located in the top directory."2122 errorMsg(frame_obj,tmpstr)2123 2124 2125 # custom IDL path2126 use_default_customidlpath = False2127 try:2128 frame_obj.customIdlPath = str(doc_cfg.getElementsByTagName("customidlpath")[0].firstChild.data)2129 except:2130 frame_obj.customIdlPath = ""2131 if len(frame_obj.customIdlPath) > 0:2132 if frame_obj.customIdlPath[len(frame_obj.customIdlPath)-1] != '/':2133 frame_obj.customIdlPath = frame_obj.customIdlPath + '/'2134 # see if directory actually exists2135 if not os.path.isdir(frame_obj.customIdlPath):2136 print "warning: wavedev.cfg customidl path " + frame_obj.customIdlPath + " does not exist"2137 print " => using default custom idl path instead"2138 use_default_customidlpath = True2139 else:2140 use_default_customidlpath = True2141 2142 if use_default_customidlpath:2143 if os.path.isdir("/usr/include/custominterfaces"):2144 frame_obj.customIdlPath = "/usr/include/custominterfaces/"2145 elif os.path.isdir("/usr/local/include/custominterfaces"):2146 frame_obj.customIdlPath = "/usr/local/include/custominterfaces/"2147 else:2148 tmpstr = "CustomInterfaces does not appear to be installed!\n"2149 tmpstr += "You will not be able to add ports to components.\n\n"2150 tmpstr += "If you have standardinterfaces installed in a location\n"2151 tmpstr += "other than the default, please specify that location\n"2152 tmpstr += "in the wavedev.cfg file located in the top directory."2153 errorMsg(frame_obj,tmpstr)2154 2155 # ossie include path2156 try:2157 frame_obj.ossieIncludePath = \2158 str(doc_cfg.getElementsByTagName("ossieincludepath")[0].firstChild.data)2159 except:2160 frame_obj.ossieIncludePath = ""2161 2162 if len(frame_obj.ossieIncludePath) > 0:2163 if frame_obj.ossieIncludePath[len(frame_obj.ossieIncludePath)-1] != '/':2164 frame_obj.ossieIncludePath = frame_obj.ossieIncludePath + '/'2165 else:2166 if os.path.isdir("/usr/include/ossie"):2167 frame_obj.ossieIncludePath = "/usr/include/ossie/"2168 elif os.path.isdir("/usr/local/include/ossie"):2169 frame_obj.ossieIncludePath = "/usr/local/include/ossie/"2170 else:2171 tmpstr = "OSSIE does not appear to be installed!\n"2172 tmpstr += "You will not be able to add ports to components\n"2173 tmpstr += "using CF interfaces.\n\n"2174 tmpstr += "If you have ossie installed in a location other than\n"2175 tmpstr += "the default please specify that location in the\n"2176 tmpstr += "wavedev.cfg file located in the top directory."2177 errorMsg(frame_obj,tmpstr)2178 2179 # home directory2180 try:2181 frame_obj.homeDir = str(doc_cfg.getElementsByTagName("homedir")[0].firstChild.data)2182 except:2183 frame_obj.homeDir = ""2184 2185 if len(frame_obj.homeDir) > 0:2186 if frame_obj.homeDir[len(frame_obj.homeDir)-1] != '/':2187 frame_obj.homeDir = frame_obj.homeDir + '/'2188 2189 -
ossiedev/branches/0.7.x/tools/WaveDev/wavedev/cfg.py
r8114 r8729 24 24 import os 25 25 26 ##------------------------------------------------------------------------- 27 ## Public functions 28 ##------------------------------------------------------------------------- 26 def LoadConfiguration(frame_obj): 27 '''Extracts information from configuration file''' 28 root = __file__ 29 if os.path.islink (root): 30 root = os.path.realpath (root) 31 root = os.path.dirname (os.path.abspath (root)) 29 32 30 def version(): 31 return ossieCfgValue('version') 33 doc_cfg = xml.dom.minidom.parse(root + '/../wavedev.cfg') 34 35 # version 36 try: 37 frame_obj.version = \ 38 str(doc_cfg.getElementsByTagName("version")[0].firstChild.data) 39 except: 40 frame_obj.version = "unknown" 41 42 # install path 43 try: 44 frame_obj.installPath = \ 45 str(doc_cfg.getElementsByTagName("installpath")[0].firstChild.data) 46 if frame_obj.installPath[len(frame_obj.installPath)-1] != '/': 47 frame_obj.installPath = frame_obj.installPath + '/' 48 except: 49 frame_obj.installPath = "" 50 51 # standard IDL path 52 use_default_stdidlpath = False 53 try: 54 frame_obj.stdIdlPath = str(doc_cfg.getElementsByTagName("stdidlpath")[0].firstChild.data) 55 except: 56 frame_obj.stdIdlPath = "" 57 if len(frame_obj.stdIdlPath) > 0: 58 if frame_obj.stdIdlPath[len(frame_obj.stdIdlPath)-1] != '/': 59 frame_obj.stdIdlPath = frame_obj.stdIdlPath + '/' 60 # see if directory actually exists 61 if not os.path.isdir(frame_obj.stdIdlPath): 62 print "warning: wavedev.cfg stdidl path " + frame_obj.stdIdlPath + " does not exist" 63 print " => using default standard idl path instead" 64 use_default_stdidlpath = True 65 else: 66 use_default_stdidlpath = True 67 68 if use_default_stdidlpath: 69 if os.path.isdir("/usr/include/standardinterfaces"): 70 frame_obj.stdIdlPath = "/usr/include/standardinterfaces/" 71 elif os.path.isdir("/usr/local/include/standardinterfaces"): 72 frame_obj.stdIdlPath = "/usr/local/include/standardinterfaces/" 73 else: 74 tmpstr = "StandardInterfaces does not appear to be installed!\n" 75 tmpstr += "You will not be able to add ports to components.\n\n" 76 tmpstr += "If you have standardinterfaces installed in a location\n" 77 tmpstr += "other than the default, please specify that location\n" 78 tmpstr += "in the wavedev.cfg file located in the top directory." 79 errorMsg(frame_obj,tmpstr) 32 80 33 81 34 def ossieInstallDir(): 35 return ossieCfgValue('installpath') 82 # custom IDL path 83 use_default_customidlpath = False 84 try: 85 frame_obj.customIdlPath = str(doc_cfg.getElementsByTagName("customidlpath")[0].firstChild.data) 86 except: 87 frame_obj.customIdlPath = "" 88 if len(frame_obj.customIdlPath) > 0: 89 if frame_obj.customIdlPath[len(frame_obj.customIdlPath)-1] != '/': 90 frame_obj.customIdlPath = frame_obj.customIdlPath + '/' 91 # see if directory actually exists 92 if not os.path.isdir(frame_obj.customIdlPath): 93 print "warning: wavedev.cfg customidl path " + frame_obj.customIdlPath + " does not exist" 94 print " => using default custom idl path instead" 95 use_default_customidlpath = True 96 else: 97 use_default_customidlpath = True 36 98 99 if use_default_customidlpath: 100 if os.path.isdir("/usr/include/custominterfaces"): 101 frame_obj.customIdlPath = "/usr/include/custominterfaces/" 102 elif os.path.isdir("/usr/local/include/custominterfaces"): 103 frame_obj.customIdlPath = "/usr/local/include/custominterfaces/" 104 else: 105 tmpstr = "CustomInterfaces does not appear to be installed!\n" 106 tmpstr += "You will not be able to add ports to components.\n\n" 107 tmpstr += "If you have standardinterfaces installed in a location\n" 108 tmpstr += "other than the default, please specify that location\n" 109 tmpstr += "in the wavedev.cfg file located in the top directory." 110 errorMsg(frame_obj,tmpstr) 37 111 38 def ossieCfgValue(key): 39 if __overrides.has_key(key): 40 return __overrides[key] 112 # ossie include path 113 try: 114 frame_obj.ossieIncludePath = \ 115 str(doc_cfg.getElementsByTagName("ossieincludepath")[0].firstChild.data) 116 except: 117 frame_obj.ossieIncludePath = "" 118 119 if len(frame_obj.ossieIncludePath) > 0: 120 if frame_obj.ossieIncludePath[len(frame_obj.ossieIncludePath)-1] != '/': 121 frame_obj.ossieIncludePath = frame_obj.ossieIncludePath + '/' 41 122 else: 42 val = __keyFromXml(key) 43 # cache it 44 setCfgValueIfNecessary(key) 45 return val 123 if os.path.isdir("/usr/include/ossie"): 124 frame_obj.ossieIncludePath = "/usr/include/ossie/" 125 elif os.path.isdir("/usr/local/include/ossie"): 126 frame_obj.ossieIncludePath = "/usr/local/include/ossie/" 127 else: 128 tmpstr = "OSSIE does not appear to be installed!\n" 129 tmpstr += "You will not be able to add ports to components\n" 130 tmpstr += "using CF interfaces.\n\n" 131 tmpstr += "If you have ossie installed in a location other than\n" 132 tmpstr += "the default please specify that location in the\n" 133 tmpstr += "wavedev.cfg file located in the top directory." 134 errorMsg(frame_obj,tmpstr) 46 135 136 # home directory 137 try: 138 frame_obj.homeDir = str(doc_cfg.getElementsByTagName("homedir")[0].firstChild.data) 139 except: 140 frame_obj.homeDir = "" 47 141 48 def overrideCfgValue(key, value): 49 __overrides['key'] = value 142 if len(frame_obj.homeDir) > 0: 143 if frame_obj.homeDir[len(frame_obj.homeDir)-1] != '/': 144 frame_obj.homeDir = frame_obj.homeDir + '/' 50 145 146 # generate source preamble 147 try: 148 frame_obj.sourcepreamble = \ 149 str(doc_cfg.getElementsByTagName("sourcepreamble")[0].firstChild.data) 150 except: 151 frame_obj.sourcepreamble = root + '/generate/generic_preamble' 51 152 52 def setCfgValueIfNecessary(key, value): 53 if not __overrides.has_key(key): 54 overrideCfgValue(key, value) 153 # generate license file 154 try: 155 frame_obj.licensefile = \ 156 str(doc_cfg.getElementsByTagName("licensefile")[0].firstChild.data) 157 except: 158 frame_obj.licensefile = "" 55 159 160 # developer 161 try: 162 frame_obj.developer = \ 163 str(doc_cfg.getElementsByTagName("developer")[0].firstChild.data) 164 except: 165 frame_obj.developer = "your_name_or_organization" 56 166 57 def commentLine():58 if __commentLine == None:59 __commentLine = u'<!--Created with OSSIE WaveDev ' + version() \60 + u'-->\n<!--Powered by Python-->\n'61 return __commentLine62 63 64 ##-------------------------------------------------------------------------65 ## Internal66 ##-------------------------------------------------------------------------67 68 __overrides = {'installpath' : '/sdr' }69 __cachedXml = None70 __commentLine = None71 72 73 def __xml():74 if __cachedXML == None:75 fileName = '../wavedev.cfg'76 if not os.path.exists(fileName):77 fileName = ossieInstallDir() + '/toos/WaveDev/wavedev.cfg'78 if os.path.exists(fileName):79 __cachedXml = xml.dom.minidom.parse(fileName)80 return __cachedXml81 82 83 def __keyFromXml(key):84 result = None85 if __xml() != None:86 result = str(__xml().getElementsByTagName(key)[0].firstChild.data)87 return result -
ossiedev/branches/0.7.x/tools/WaveDev/wavedev/generate/genNode.py
r8170 r8729 21 21 import sys, os, shutil 22 22 from WaveDev.wavedev.errorMsg import * 23 from WaveDev.wavedev.cfg import LoadConfiguration 24 from datetime import date 23 25 24 26 class genAll: … … 32 34 self.path = path 33 35 self.node = node 36 LoadConfiguration(self) 34 37 35 38 ############################################################################## … … 131 134 inputH = open(self.wavedevPath + 'generate/sampleComp.h','r') 132 135 outputH = open(self.path + comp.name + "/" + comp.name + ".h",'w') 133 self.add GPL(outputH,comp.name)136 self.addPreamble(outputH,comp.name) 134 137 for line in inputH.readlines(): 135 138 l_out = line.replace("__CLASS_DEF__",comp.name.upper()+"_IMPL_H") … … 166 169 inputCPP = open(self.wavedevPath + 'generate/sampleComp.cpp','r') 167 170 outputCPP = open(self.path + comp.name + "/" + comp.name + ".cpp",'w') 168 self.add GPL(outputCPP,comp.name)171 self.addPreamble(outputCPP,comp.name) 169 172 for line in inputCPP.readlines(): 170 173 l_out = line.replace("__IncludeFile__",comp.name) … … 195 198 inputMain = open(self.wavedevPath + 'generate/sampleMain.cpp','r') 196 199 outputMain = open(self.path + comp.name + "/main.cpp",'w') 197 self.add GPL(outputMain,comp.name)200 self.addPreamble(outputMain,comp.name) 198 201 199 202 for line in inputMain.readlines(): … … 223 226 inputPortImpl = open(self.wavedevPath + 'generate/port_impl.h','r') 224 227 outputPortImpl = open(self.path + comp.name + "/port_impl.h",'w') 225 self.add GPL(outputPortImpl,comp.name)228 self.addPreamble(outputPortImpl,comp.name) 226 229 portSample_p = open(self.wavedevPath + 'generate/port_sample_p.h','r') 227 230 portSample_u = open(self.wavedevPath + 'generate/port_sample_u.h','r') … … 251 254 inputPortImpl = open(self.wavedevPath + 'generate/port_impl.cpp','r') 252 255 outputPortImpl = open(self.path + comp.name + "/port_impl.cpp",'w') 253 self.add GPL(outputPortImpl,comp.name)256 self.addPreamble(outputPortImpl,comp.name) 254 257 portSample_p = open(self.wavedevPath + 'generate/port_sample_p.cpp','r') 255 258 portSample_u = open(self.wavedevPath + 'generate/port_sample_u.cpp','r') … … 1019 1022 1020 1023 1021 def add GPL(self,outFile,name):1022 inFile = open(self. wavedevPath + 'generate/gpl_preamble','r')1024 def addPreamble(self,outFile,name): 1025 inFile = open(self.sourcepreamble,'r') 1023 1026 for line in inFile.readlines(): 1024 1027 l_out = line.replace("__COMP_NAME__",name) 1028 l_out = l_out.replace("__YEAR__",date.today().year.__str__()) 1029 l_out = l_out.replace("__DEVELOPER__",self.developer) 1025 1030 outFile.write(l_out) 1026 1031 -
ossiedev/branches/0.7.x/tools/WaveDev/wavedev/generate/templates/basic_ports/genStructure.py
r8170 r8729 20 20 21 21 import sys, os, shutil 22 from WaveDev.wavedev.cfg import LoadConfiguration 23 from datetime import date 22 24 try: 23 25 from WaveDev.wavedev.errorMsg import * … … 36 38 self.wavedevPath = wavedevPath 37 39 self.active_wave = active_wave 40 LoadConfiguration(self) 38 41 39 42 ############################################################################## … … 65 68 if not os.path.isdir(f): 66 69 shutil.copy(self.wavedevPath + 'generate/basic_xml/' + f,self.path + x.name) 67 shutil.copy(self.wavedevPath + 'generate/LICENSE',self.path + x.name) 70 if self.licensefile != "": 71 shutil.copy(self.licensefile,self.path + x.name + '/LICENSE') 68 72 69 73 ############################################################################## … … 276 280 inputH = open(self.wavedevPath + 'generate/templates/basic_ports/sampleComp.h','r') 277 281 outputH = open(self.path + comp.name + "/" + comp.name + ".h",'w') 278 self.add GPL(outputH,comp.name)282 self.addPreamble(outputH,comp.name) 279 283 for line in inputH.readlines(): 280 284 l_out = line.replace("__CLASS_DEF__",comp.name.upper()+"_IMPL_H") … … 326 330 inputCPP = open(self.wavedevPath + 'generate/templates/basic_ports/sampleComp.cpp','r') 327 331 outputCPP = open(self.path + comp.name + "/" + comp.name + ".cpp",'w') 328 self.add GPL(outputCPP,comp.name)332 self.addPreamble(outputCPP,comp.name) 329 333 for line in inputCPP.readlines(): 330 334 l_out = line.replace("__IncludeFile__",comp.name) … … 371 375 inputMain = open(self.wavedevPath + 'generate/templates/basic_ports/sampleMain.cpp','r') 372 376 outputMain = open(self.path + comp.name + "/main.cpp",'w') 373 self.add GPL(outputMain,comp.name)377 self.addPreamble(outputMain,comp.name) 374 378 375 379 for line in inputMain.readlines(): … … 391 395 inputDoc = open(self.wavedevPath + 'generate/templates/basic_ports/sampleDocumentation.txt','r') 392 396 outputDoc = open(self.path + comp.name + '/documentation.txt','w') 393 self.add GPL(outputDoc, comp.name)397 self.addPreamble(outputDoc, comp.name) 394 398 395 399 for line in inputDoc.readlines(): … … 419 423 ## inputPortImpl = open(self.wavedevPath + 'generate/port_impl.h','r') 420 424 ## outputPortImpl = open(self.path + comp.name + "/port_impl.h",'w') 421 ## self.add GPL(outputPortImpl,comp.name)425 ## self.addPreamble(outputPortImpl,comp.name) 422 426 ## portSample = open(self.wavedevPath + 'generate/port_sample.h','r') 423 427 ## for line in inputPortImpl.readlines(): … … 440 444 ## inputPortImpl = open(self.wavedevPath + 'generate/port_impl.cpp','r') 441 445 ## outputPortImpl = open(self.path + comp.name + "/port_impl.cpp",'w') 442 ## self.add GPL(outputPortImpl,comp.name)446 ## self.addPreamble(outputPortImpl,comp.name) 443 447 ## portSample = open(self.wavedevPath + 'generate/port_sample.cpp','r') 444 448 ## for line in inputPortImpl.readlines(): … … 1644 1648 1645 1649 1646 def add GPL(self,outFile,name):1647 inFile = open(self. wavedevPath + 'generate/gpl_preamble','r')1650 def addPreamble(self,outFile,name): 1651 inFile = open(self.sourcepreamble,'r') 1648 1652 for line in inFile.readlines(): 1649 1653 l_out = line.replace("__COMP_NAME__",name) 1654 l_out = l_out.replace("__YEAR__",date.today().year.__str__()) 1655 l_out = l_out.replace("__DEVELOPER__",self.developer) 1650 1656 outFile.write(l_out) 1651 1657 -
ossiedev/branches/0.7.x/tools/WaveDev/wavedev/generate/templates/custom_ports/genStructure.py
r8170 r8729 20 20 21 21 import sys, os, shutil 22 from WaveDev.wavedev.cfg import LoadConfiguration 23 from datetime import date 22 24 23 25 try: … … 37 39 self.wavedevPath = wavedevPath 38 40 self.active_wave = active_wave 41 LoadConfiguration(self) 39 42 40 43 ############################################################################## … … 66 69 # if not os.path.isdir(f): 67 70 # shutil.copy(self.wavedevPath + 'generate/basic_xml/' + f,self.path + x.name) 68 shutil.copy(self.wavedevPath + 'generate/LICENSE',self.path + x.name) 71 if self.licensefile != "": 72 shutil.copy(self.licensefile,self.path + x.name + '/LICENSE') 69 73 70 74 ############################################################################## … … 305 309 inputH = open(self.wavedevPath + 'generate/templates/custom_ports/sampleComp.h','r') 306 310 outputH = open(self.path + comp.name + "/" + comp.name + ".h",'w') 307 self.add GPL(outputH,comp.name)311 self.addPreamble(outputH,comp.name) 308 312 for line in inputH.readlines(): 309 313 l_out = line.replace("__CLASS_DEF__",comp.name.upper()+"_IMPL_H") … … 340 344 inputCPP = open(self.wavedevPath + 'generate/templates/custom_ports/sampleComp.cpp','r') 341 345 outputCPP = open(self.path + comp.name + "/" + comp.name + ".cpp",'w') 342 self.add GPL(outputCPP,comp.name)346 self.addPreamble(outputCPP,comp.name) 343 347 for line in inputCPP.readlines(): 344 348 l_out = line.replace("__IncludeFile__",comp.name) … … 370 374 inputMain = open(self.wavedevPath + 'generate/templates/custom_ports/sampleMain.cpp','r') 371 375 outputMain = open(self.path + comp.name + "/main.cpp",'w') 372 self.add GPL(outputMain,comp.name)376 self.addPreamble(outputMain,comp.name) 373 377 374 378 for line in inputMain.readlines(): … … 399 403 inputPortImpl = open(self.wavedevPath + 'generate/templates/custom_ports/port_impl.h','r') 400 404 outputPortImpl = open(self.path + comp.name + "/port_impl.h",'w') 401 self.add GPL(outputPortImpl,comp.name)405 self.addPreamble(outputPortImpl,comp.name) 402 406 portSample_p = open(self.wavedevPath + 'generate/templates/custom_ports/port_sample_p.h','r') 403 407 portSample_u = open(self.wavedevPath + 'generate/templates/custom_ports/port_sample_u.h','r') … … 427 431 inputPortImpl = open(self.wavedevPath + 'generate/templates/custom_ports/port_impl.cpp','r') 428 432 outputPortImpl = open(self.path + comp.name + "/port_impl.cpp",'w') 429 self.add GPL(outputPortImpl,comp.name)433 self.addPreamble(outputPortImpl,comp.name) 430 434 portSample_p = open(self.wavedevPath + 'generate/templates/custom_ports/port_sample_p.cpp','r') 431 435 portSample_u = open(self.wavedevPath + 'generate/templates/custom_ports/port_sample_u.cpp','r') … … 1211 1215 1212 1216 1213 def add GPL(self,outFile,name):1214 inFile = open(self. wavedevPath + 'generate/gpl_preamble','r')1217 def addPreamble(self,outFile,name): 1218 inFile = open(self.sourcepreamble,'r') 1215 1219 for line in inFile.readlines(): 1216 1220 l_out = line.replace("__COMP_NAME__",name) 1221 l_out = l_out.replace("__YEAR__",date.today().year.__str__()) 1222 l_out = l_out.replace("__DEVELOPER__",self.developer) 1217 1223 outFile.write(l_out) 1218 1224 -
ossiedev/branches/0.7.x/tools/WaveDev/wavedev/generate/templates/py_comp/genStructure.py
r8161 r8729 21 21 import os, shutil 22 22 from WaveDev.wavedev.errorMsg import * 23 from WaveDev.wavedev.cfg import LoadConfiguration 24 from datetime import date 23 25 24 26 class genAll: … … 31 33 self.wavedevPath = wavedevPath 32 34 self.active_wave = active_wave 35 LoadConfiguration(self) 33 36 34 37 … … 43 46 #copy over the readme file 44 47 shutil.copy(self.wavedevPath + 'generate/templates/py_comp/README', compPath) 48 49 #copy over the license file 50 if self.licensefile != "": 51 shutil.copy(self.licensefile, compPath + '/LICENSE') 45 52 46 53 if compPath[len(compPath)-1] != '/': … … 114 121 115 122 #add the generic public license to the beginning of the component main .py file 116 self.add GPL(output, comp.name)123 self.addPreamble(output, comp.name) 117 124 118 125 for line in input_tmpl.readlines(): … … 166 173 167 174 #add the generic public license to the beginning of the generated WorkModule file 168 self.add GPL(output_wm, comp.name)175 self.addPreamble(output_wm, comp.name) 169 176 170 177 for line in input_wm.readlines(): … … 537 544 538 545 539 def add GPL(self,outFile,name):546 def addPreamble(self,outFile,name): 540 547 '''Creates a GPL for the component. The new GPL will have the component 541 548 name. The new GPL is written to the beginning of the outFile''' 542 549 543 inFile = open(self. wavedevPath + 'generate/gpl_preamble','r')550 inFile = open(self.sourcepreamble,'r') 544 551 outFile.write('#! /usr/bin/env python\n\n') 545 552 outFile.write("'''\n") 546 553 for line in inFile.readlines(): 547 554 l_out = line.replace("__COMP_NAME__",name) 555 l_out = l_out.replace("__YEAR__",date.today().year.__str__()) 556 l_out = l_out.replace("__DEVELOPER__",self.developer) 548 557 outFile.write(l_out) 549 558 outFile.write("'''\n\n") -
ossiedev/branches/0.7.x/tools/setup.py
r8454 r8729 25 25 wavedev_files=['images/*'] 26 26 xml_gen_files=['templates/*', 'DevMan/*', 'dtd/*', 'README'] 27 generate_files=['g pl_preamble', 'basic_xml/*', 'LICENSE', 'reconf']27 generate_files=['generic_preamble', 'gpl_preamble', 'basic_xml/*', 'LICENSE', 'reconf'] 28 28 basic_ports_files=['*.cpp', '*.h', 'sampleDocumentation.txt', 'sampleDoxyfile'] 29 29 custom_ports_files=['*.cpp', '*.h']