Changeset 8729

Show
Ignore:
Timestamp:
02/18/09 16:22:54 (4 years ago)
Author:
jawil06
Message:

Merged from trunk revision 8728:
OWD can now generate licenses for entities other than Virginia Tech (see ticket #255).
wavedev.cfg now contains license, source code preamble, and developer information. License and preamble pathes are absolute.

Location:
ossiedev/branches/0.7.x/tools
Files:
2 removed
9 modified
1 copied

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/0.7.x/tools/WaveDev/wavedev.cfg

    r5885 r8729  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<owdconfiguration> 
    3     <version>Beta Version 0.6.2</version> 
     3    <version>Beta Version 0.7.2</version> 
    44    <installpath>/sdr</installpath> 
    55    <stdidlpath></stdidlpath> 
    66    <ossieincludepath></ossieincludepath> 
    77    <homedir></homedir> 
     8    <sourcepreamble></sourcepreamble> 
     9    <licensefile></licensefile> 
     10    <developer></developer> 
    811</owdconfiguration> 
  • ossiedev/branches/0.7.x/tools/WaveDev/wavedev/ComponentFrame.py

    r8170 r8729  
    3131import cPickle 
    3232import PropertiesDialog 
    33 import MainFrame 
     33import cfg 
    3434import string 
    3535 
     
    353353            self.menuComponent.Enable(wxID_COMPFRAMEMENUCOMPONENTGENERATE,True) 
    354354            self.compDescrBox.Enable(True) 
    355             MainFrame.LoadConfiguration(self) 
     355            cfg.LoadConfiguration(self) 
    356356        else: 
    357357            self.menuComponent.Enable(wxID_COMPFRAMEMENUCOMPONENTGENERATE,False) 
     
    10281028                    shutil.copy(self.wavedevPath + '/generate/reconf',self.path) 
    10291029                    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') 
    10311032 
    10321033        if self.active_comp.timing: 
  • ossiedev/branches/0.7.x/tools/WaveDev/wavedev/MainFrame.py

    r8260 r8729  
    3131import importNode 
    3232import NodeDialog 
    33 import xml.dom.minidom 
     33import cfg 
    3434from xml.dom.minidom import Node 
    3535import generate.genNode as genNode 
     
    463463 
    464464        #read in the configuration information 
    465         LoadConfiguration(self) 
     465        cfg.LoadConfiguration(self) 
    466466 
    467467        #setup the environment 
     
    20622062                cid1 = self.nodeBox.GetNextSibling(cid1) 
    20632063 
    2064 ############################################################################### 
    2065 ## LoadConfiguration 
    2066 ## This function is not a part of the frame class so that other modules can 
    2067 ## call it 
    2068 ############################################################################### 
    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     # version 
    2079     try: 
    2080         frame_obj.version = \ 
    2081                 str(doc_cfg.getElementsByTagName("version")[0].firstChild.data) 
    2082     except: 
    2083         frame_obj.version = "unknown" 
    2084  
    2085     # install path 
    2086     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 path 
    2095     use_default_stdidlpath = False 
    2096     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 exists 
    2104         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 = True 
    2108     else: 
    2109         use_default_stdidlpath = True 
    2110  
    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 path 
    2126     use_default_customidlpath = False 
    2127     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 exists 
    2135         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 = True 
    2139     else: 
    2140         use_default_customidlpath = True 
    2141  
    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 path 
    2156     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 directory 
    2180     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  
    2424import os 
    2525 
    26 ##------------------------------------------------------------------------- 
    27 ## Public functions 
    28 ##------------------------------------------------------------------------- 
     26def 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)) 
    2932 
    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) 
    3280 
    3381 
    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 
    3698 
     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) 
    37111 
    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 + '/' 
    41122    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) 
    46135 
     136    # home directory 
     137    try: 
     138        frame_obj.homeDir = str(doc_cfg.getElementsByTagName("homedir")[0].firstChild.data) 
     139    except: 
     140        frame_obj.homeDir = "" 
    47141 
    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 + '/' 
    50145 
     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' 
    51152 
    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 = "" 
    55159 
     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" 
    56166 
    57 def commentLine(): 
    58     if __commentLine == None: 
    59         __commentLine = u'<!--Created with OSSIE WaveDev ' + version() \ 
    60             + u'-->\n<!--Powered by Python-->\n' 
    61     return __commentLine 
    62  
    63  
    64 ##------------------------------------------------------------------------- 
    65 ## Internal 
    66 ##------------------------------------------------------------------------- 
    67  
    68 __overrides = {'installpath' : '/sdr' } 
    69 __cachedXml = None 
    70 __commentLine = None 
    71  
    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 __cachedXml 
    81  
    82  
    83 def __keyFromXml(key): 
    84     result = None 
    85     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  
    2121import sys, os, shutil 
    2222from WaveDev.wavedev.errorMsg import * 
     23from WaveDev.wavedev.cfg import LoadConfiguration 
     24from datetime import date 
    2325 
    2426class genAll: 
     
    3234    self.path = path 
    3335    self.node = node 
     36    LoadConfiguration(self) 
    3437 
    3538  ############################################################################## 
     
    131134        inputH = open(self.wavedevPath + 'generate/sampleComp.h','r') 
    132135        outputH = open(self.path + comp.name + "/" + comp.name + ".h",'w') 
    133         self.addGPL(outputH,comp.name) 
     136        self.addPreamble(outputH,comp.name) 
    134137        for line in inputH.readlines(): 
    135138          l_out = line.replace("__CLASS_DEF__",comp.name.upper()+"_IMPL_H") 
     
    166169        inputCPP = open(self.wavedevPath + 'generate/sampleComp.cpp','r') 
    167170        outputCPP = open(self.path + comp.name + "/" + comp.name + ".cpp",'w') 
    168         self.addGPL(outputCPP,comp.name) 
     171        self.addPreamble(outputCPP,comp.name) 
    169172        for line in inputCPP.readlines(): 
    170173          l_out = line.replace("__IncludeFile__",comp.name) 
     
    195198        inputMain = open(self.wavedevPath + 'generate/sampleMain.cpp','r') 
    196199        outputMain = open(self.path + comp.name + "/main.cpp",'w') 
    197         self.addGPL(outputMain,comp.name) 
     200        self.addPreamble(outputMain,comp.name) 
    198201 
    199202        for line in inputMain.readlines(): 
     
    223226        inputPortImpl = open(self.wavedevPath + 'generate/port_impl.h','r') 
    224227        outputPortImpl = open(self.path + comp.name + "/port_impl.h",'w') 
    225         self.addGPL(outputPortImpl,comp.name) 
     228        self.addPreamble(outputPortImpl,comp.name) 
    226229        portSample_p = open(self.wavedevPath + 'generate/port_sample_p.h','r') 
    227230        portSample_u = open(self.wavedevPath + 'generate/port_sample_u.h','r') 
     
    251254        inputPortImpl = open(self.wavedevPath + 'generate/port_impl.cpp','r') 
    252255        outputPortImpl = open(self.path + comp.name + "/port_impl.cpp",'w') 
    253         self.addGPL(outputPortImpl,comp.name) 
     256        self.addPreamble(outputPortImpl,comp.name) 
    254257        portSample_p = open(self.wavedevPath + 'generate/port_sample_p.cpp','r') 
    255258        portSample_u = open(self.wavedevPath + 'generate/port_sample_u.cpp','r') 
     
    10191022 
    10201023 
    1021   def addGPL(self,outFile,name): 
    1022       inFile = open(self.wavedevPath + 'generate/gpl_preamble','r') 
     1024  def addPreamble(self,outFile,name): 
     1025      inFile = open(self.sourcepreamble,'r') 
    10231026      for line in inFile.readlines(): 
    10241027          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) 
    10251030          outFile.write(l_out) 
    10261031 
  • ossiedev/branches/0.7.x/tools/WaveDev/wavedev/generate/templates/basic_ports/genStructure.py

    r8170 r8729  
    2020 
    2121import sys, os, shutil 
     22from WaveDev.wavedev.cfg import LoadConfiguration 
     23from datetime import date 
    2224try: 
    2325    from WaveDev.wavedev.errorMsg import * 
     
    3638    self.wavedevPath = wavedevPath 
    3739    self.active_wave = active_wave 
     40    LoadConfiguration(self) 
    3841 
    3942  ############################################################################## 
     
    6568                    if not os.path.isdir(f): 
    6669                        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') 
    6872 
    6973  ############################################################################## 
     
    276280        inputH = open(self.wavedevPath + 'generate/templates/basic_ports/sampleComp.h','r') 
    277281        outputH = open(self.path + comp.name + "/" + comp.name + ".h",'w') 
    278         self.addGPL(outputH,comp.name) 
     282        self.addPreamble(outputH,comp.name) 
    279283        for line in inputH.readlines(): 
    280284          l_out = line.replace("__CLASS_DEF__",comp.name.upper()+"_IMPL_H") 
     
    326330        inputCPP = open(self.wavedevPath + 'generate/templates/basic_ports/sampleComp.cpp','r') 
    327331        outputCPP = open(self.path + comp.name + "/" + comp.name + ".cpp",'w') 
    328         self.addGPL(outputCPP,comp.name) 
     332        self.addPreamble(outputCPP,comp.name) 
    329333        for line in inputCPP.readlines(): 
    330334          l_out = line.replace("__IncludeFile__",comp.name) 
     
    371375        inputMain = open(self.wavedevPath + 'generate/templates/basic_ports/sampleMain.cpp','r') 
    372376        outputMain = open(self.path + comp.name + "/main.cpp",'w') 
    373         self.addGPL(outputMain,comp.name) 
     377        self.addPreamble(outputMain,comp.name) 
    374378 
    375379        for line in inputMain.readlines(): 
     
    391395        inputDoc = open(self.wavedevPath + 'generate/templates/basic_ports/sampleDocumentation.txt','r') 
    392396        outputDoc = open(self.path + comp.name + '/documentation.txt','w') 
    393         self.addGPL(outputDoc, comp.name) 
     397        self.addPreamble(outputDoc, comp.name) 
    394398 
    395399        for line in inputDoc.readlines(): 
     
    419423##        inputPortImpl = open(self.wavedevPath + 'generate/port_impl.h','r') 
    420424##        outputPortImpl = open(self.path + comp.name + "/port_impl.h",'w') 
    421 ##        self.addGPL(outputPortImpl,comp.name) 
     425##        self.addPreamble(outputPortImpl,comp.name) 
    422426##        portSample = open(self.wavedevPath + 'generate/port_sample.h','r') 
    423427##        for line in inputPortImpl.readlines(): 
     
    440444##        inputPortImpl = open(self.wavedevPath + 'generate/port_impl.cpp','r') 
    441445##        outputPortImpl = open(self.path + comp.name + "/port_impl.cpp",'w') 
    442 ##        self.addGPL(outputPortImpl,comp.name) 
     446##        self.addPreamble(outputPortImpl,comp.name) 
    443447##        portSample = open(self.wavedevPath + 'generate/port_sample.cpp','r') 
    444448##        for line in inputPortImpl.readlines(): 
     
    16441648 
    16451649 
    1646   def addGPL(self,outFile,name): 
    1647       inFile = open(self.wavedevPath + 'generate/gpl_preamble','r') 
     1650  def addPreamble(self,outFile,name): 
     1651      inFile = open(self.sourcepreamble,'r') 
    16481652      for line in inFile.readlines(): 
    16491653          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) 
    16501656          outFile.write(l_out) 
    16511657 
  • ossiedev/branches/0.7.x/tools/WaveDev/wavedev/generate/templates/custom_ports/genStructure.py

    r8170 r8729  
    2020 
    2121import sys, os, shutil 
     22from WaveDev.wavedev.cfg import LoadConfiguration 
     23from datetime import date 
    2224 
    2325try: 
     
    3739    self.wavedevPath = wavedevPath 
    3840    self.active_wave = active_wave 
     41    LoadConfiguration(self) 
    3942 
    4043  ############################################################################## 
     
    6669                #    if not os.path.isdir(f): 
    6770                #        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') 
    6973 
    7074  ############################################################################## 
     
    305309        inputH = open(self.wavedevPath + 'generate/templates/custom_ports/sampleComp.h','r') 
    306310        outputH = open(self.path + comp.name + "/" + comp.name + ".h",'w') 
    307         self.addGPL(outputH,comp.name) 
     311        self.addPreamble(outputH,comp.name) 
    308312        for line in inputH.readlines(): 
    309313          l_out = line.replace("__CLASS_DEF__",comp.name.upper()+"_IMPL_H") 
     
    340344        inputCPP = open(self.wavedevPath + 'generate/templates/custom_ports/sampleComp.cpp','r') 
    341345        outputCPP = open(self.path + comp.name + "/" + comp.name + ".cpp",'w') 
    342         self.addGPL(outputCPP,comp.name) 
     346        self.addPreamble(outputCPP,comp.name) 
    343347        for line in inputCPP.readlines(): 
    344348          l_out = line.replace("__IncludeFile__",comp.name) 
     
    370374        inputMain = open(self.wavedevPath + 'generate/templates/custom_ports/sampleMain.cpp','r') 
    371375        outputMain = open(self.path + comp.name + "/main.cpp",'w') 
    372         self.addGPL(outputMain,comp.name) 
     376        self.addPreamble(outputMain,comp.name) 
    373377 
    374378        for line in inputMain.readlines(): 
     
    399403        inputPortImpl = open(self.wavedevPath + 'generate/templates/custom_ports/port_impl.h','r') 
    400404        outputPortImpl = open(self.path + comp.name + "/port_impl.h",'w') 
    401         self.addGPL(outputPortImpl,comp.name) 
     405        self.addPreamble(outputPortImpl,comp.name) 
    402406        portSample_p = open(self.wavedevPath + 'generate/templates/custom_ports/port_sample_p.h','r') 
    403407        portSample_u = open(self.wavedevPath + 'generate/templates/custom_ports/port_sample_u.h','r') 
     
    427431        inputPortImpl = open(self.wavedevPath + 'generate/templates/custom_ports/port_impl.cpp','r') 
    428432        outputPortImpl = open(self.path + comp.name + "/port_impl.cpp",'w') 
    429         self.addGPL(outputPortImpl,comp.name) 
     433        self.addPreamble(outputPortImpl,comp.name) 
    430434        portSample_p = open(self.wavedevPath + 'generate/templates/custom_ports/port_sample_p.cpp','r') 
    431435        portSample_u = open(self.wavedevPath + 'generate/templates/custom_ports/port_sample_u.cpp','r') 
     
    12111215 
    12121216 
    1213   def addGPL(self,outFile,name): 
    1214       inFile = open(self.wavedevPath + 'generate/gpl_preamble','r') 
     1217  def addPreamble(self,outFile,name): 
     1218      inFile = open(self.sourcepreamble,'r') 
    12151219      for line in inFile.readlines(): 
    12161220          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) 
    12171223          outFile.write(l_out) 
    12181224 
  • ossiedev/branches/0.7.x/tools/WaveDev/wavedev/generate/templates/py_comp/genStructure.py

    r8161 r8729  
    2121import os, shutil 
    2222from WaveDev.wavedev.errorMsg import * 
     23from WaveDev.wavedev.cfg import LoadConfiguration 
     24from datetime import date 
    2325 
    2426class genAll: 
     
    3133    self.wavedevPath = wavedevPath 
    3234    self.active_wave = active_wave 
     35    LoadConfiguration(self) 
    3336 
    3437 
     
    4346    #copy over the readme file 
    4447    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') 
    4552 
    4653    if compPath[len(compPath)-1] != '/': 
     
    114121 
    115122      #add the generic public license to the beginning of the component main .py file 
    116       self.addGPL(output, comp.name) 
     123      self.addPreamble(output, comp.name) 
    117124 
    118125      for line in input_tmpl.readlines(): 
     
    166173 
    167174      #add the generic public license to the beginning of the generated WorkModule file 
    168       self.addGPL(output_wm, comp.name) 
     175      self.addPreamble(output_wm, comp.name) 
    169176 
    170177      for line in input_wm.readlines(): 
     
    537544 
    538545 
    539   def addGPL(self,outFile,name): 
     546  def addPreamble(self,outFile,name): 
    540547      '''Creates a GPL for the component.  The new GPL will have the component 
    541548name.  The new GPL is written to the beginning of the outFile''' 
    542549 
    543       inFile = open(self.wavedevPath + 'generate/gpl_preamble','r') 
     550      inFile = open(self.sourcepreamble,'r') 
    544551      outFile.write('#! /usr/bin/env python\n\n') 
    545552      outFile.write("'''\n") 
    546553      for line in inFile.readlines(): 
    547554          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) 
    548557          outFile.write(l_out) 
    549558      outFile.write("'''\n\n") 
  • ossiedev/branches/0.7.x/tools/setup.py

    r8454 r8729  
    2525wavedev_files=['images/*'] 
    2626xml_gen_files=['templates/*', 'DevMan/*', 'dtd/*', 'README'] 
    27 generate_files=['gpl_preamble', 'basic_xml/*', 'LICENSE', 'reconf'] 
     27generate_files=['generic_preamble', 'gpl_preamble', 'basic_xml/*', 'LICENSE', 'reconf'] 
    2828basic_ports_files=['*.cpp', '*.h', 'sampleDocumentation.txt', 'sampleDoxyfile'] 
    2929custom_ports_files=['*.cpp', '*.h']