Changeset 8114

Show
Ignore:
Timestamp:
07/31/08 13:20:38 (5 years ago)
Author:
Snyder.Jason
Message:

merging jsnyder branch of wavedev back into truck

Location:
ossiedev/trunk/tools/WaveDev/wavedev
Files:
3 modified
2 copied

Legend:

Unmodified
Added
Removed
  • ossiedev/trunk/tools/WaveDev/wavedev/XML_gen/application_gen.py

    r8112 r8114  
    2222import shutil 
    2323import component_gen 
    24 from component_gen import ensureDocType 
    2524import xml.dom.minidom 
    2625from xml.dom.minidom import Node 
     
    3029 
    3130 
    32 commentLine = u'<!--Created with OSSIE WaveDev ' \ 
    33     + u'-->\n<!--Powered by Python-->\n' 
     31 
     32 
     33commentLine = u'<!-- Created with OSSIE WaveDev-->\n<!--Powered by Python-->\n' 
     34 
    3435xmlpath = u'/xml/' 
    3536####################################################################### 
     
    273274            assemblycontrollerNode.getElementsByTagName("componentinstantiationref")[0].setAttribute("refid", assemblycontroller_id) 
    274275 
    275     # Define <!DOCTYPE> here (overriding template if necessary) 
    276     ensureDocType(doc_sad, u'softwareassembly', u'../../xml/dtd/softwareassembly.dtd') 
    277  
    278276    # Create and beautify the SAD file as a temporary file 
    279277    data = doc_sad.toxml('UTF-8') 
     
    281279 
    282280    # Post Processing - add some of the header lines 
     281 
    283282 
    284283    preProcessed_sad = open(waveformDir + '.' + outputFilename_sad + '.tmp', 'r') 
     
    289288    remaining = preProcessed_sad.readlines() 
    290289    postProcessed_sad.writelines(line0) 
    291     #postProcessed_sad.writelines(u'<!DOCTYPE softwareassembly SYSTEM \"../../xml/dtd/softwareassembly.dtd\">\n') 
     290    postProcessed_sad.writelines(u'<!DOCTYPE softwareassembly SYSTEM \"../../xml/dtd/softwareassembly.dtd\">\n') 
    292291    postProcessed_sad.writelines(commentLine) 
    293292    postProcessed_sad.writelines(remaining) 
     
    296295    # Remove temporary files 
    297296    os.remove(waveformDir + '.' + outputFilename_sad + '.tmp') 
     297 
    298298 
    299299    ####################### 
     
    343343        deviceassignmentsequenceNode.appendChild(deviceassignmenttypeNode) 
    344344 
    345     # Define <!DOCTYPE> here (overriding template if necessary) 
    346     # ensureDocType(das, u'deploymentenforcement', u'../../xml/dtd/deploymentenforcement.dtd') 
    347345    data = das.toxml('UTF-8') 
    348346    xmlBeautify.beautify(data,path+'.'+waveName+'_DAS.xml.tmp') 
     347 
     348 
    349349 
    350350    # Post Processing - add some of the header lines 
     
    365365    os.remove(path+'.'+waveName+'_DAS.xml.tmp') 
    366366 
     367 
    367368################################################################################ 
    368369# Generate the DeviceManager XML files 
     
    391392    localfileNode.setAttribute("name", unicode(dmName) + u'.scd.xml') 
    392393 
    393     # Define <!DOCTYPE> here (overriding template if necessary) 
    394     ensureDocType(doc_spd, u'softpkg', u'../../xml/dtd/softpkg.dtd') 
     394    data = doc_spd.toxml('UTF-8') 
     395    xmlBeautify.beautify(data,path + '.' + outputFilename_spd + '.tmp') 
    395396    data = doc_spd.toxml('UTF-8') 
    396397    xmlBeautify.beautify(data,path + '.' + outputFilename_spd + '.tmp') 
     
    414415    os.remove(path + '.' + outputFilename_spd + '.tmp') 
    415416 
     417 
    416418    #tempDM = CC.Component(dmName,generate=False) 
    417419    #component_gen.gen_scd(tempDM,waveformDir,node.name) 
     420 
     421 
     422    # Post Processing - add some of the header lines 
     423 
     424    preProcessed_spd = open(path + '.' + outputFilename_spd + '.tmp', 'r') 
     425    postProcessed_spd = open(path + outputFilename_spd, 'w') 
     426 
     427    # Specify external DTD 
     428    line0 = preProcessed_spd.readline() 
     429    remaining = preProcessed_spd.readlines() 
     430    postProcessed_spd.writelines(line0) 
     431    postProcessed_spd.writelines(u'<!DOCTYPE softpkg SYSTEM \"../../xml/dtd/softpkg.dtd\">\n') 
     432    postProcessed_spd.writelines(commentLine) 
     433    postProcessed_spd.writelines(remaining) 
     434    postProcessed_spd.close() 
     435 
     436    # Remove temporary files 
     437    os.remove(path + '.' + outputFilename_spd + '.tmp') 
     438 
     439    #tempDM = CC.Component(dmName,generate=False) 
     440    #component_gen.gen_scd(tempDM,waveformDir,node.name) 
     441 
    418442 
    419443    # Copy the scd and prf files to directory - these aren't changed yet 
     
    482506        partitioningNode.appendChild(componentplacementNode) 
    483507 
    484     # Define <!DOCTYPE> here (overriding template if necessary) 
    485     ensureDocType(doc_dcd, u'deviceconfiguration', u'../../xml/dtd/deviceconfiguration.dtd') 
     508    # Create and beautify the dcd file as a temporary file 
     509    data = doc_dcd.toxml('UTF-8') 
     510    xmlBeautify.beautify(data,path + '.' + outputFilename_dcd + '.tmp') 
    486511    # Create and beautify the dcd file as a temporary file 
    487512    data = doc_dcd.toxml('UTF-8') 
  • ossiedev/trunk/tools/WaveDev/wavedev/XML_gen/component_gen.py

    r8112 r8114  
    2424import xml.dom.minidom 
    2525from xml.dom.minidom import Node 
     26 
    2627import xmlBeautify 
    2728import uuidgen  
    2829 
    2930 
     31 
    3032xmlpath = u'xml/' 
    3133binpath = u'bin/' 
    3234 
    33 commentLine = u'<!--Created with OSSIE WaveDev ' + u'-->\n<!--Powered by Python-->\n'  
     35 
     36commentLine = u'<!--Created with OSSIE WaveDev-->\n<!--Powered by Python-->\n' 
    3437 
    3538def gen_scd(comp, waveformDir, wavedevPath): 
     
    99102    outputFileName_scd = comp.name + '.scd.xml' 
    100103 
    101     # Define <!DOCTYPE> here (overriding template if necessary) 
    102     ensureDocType(doc_scd, u'softwarecomponent', u'../dtd/softwarecomponent.dtd') 
     104    data = doc_scd.toxml('UTF-8') 
     105    xmlBeautify.beautify(data,compDir + '.' + outputFileName_scd + '.tmp') 
     106 
     107    preProcessed_scd = open(compDir + '.' + outputFileName_scd + '.tmp', 'r') 
     108    postProcessed_scd = open(compDir + outputFileName_scd, 'w') 
     109 
     110    # Specify external DTD 
     111    line0 = preProcessed_scd.readline() 
     112    remaining = preProcessed_scd.readlines() 
     113    postProcessed_scd.writelines(line0) 
     114    postProcessed_scd.writelines(u'<!DOCTYPE softwarecomponent SYSTEM \"../dtd/softwarecomponent.dtd\">\n') 
     115    postProcessed_scd.writelines(commentLine) 
     116    postProcessed_scd.writelines(remaining) 
     117    postProcessed_scd.close() 
     118 
     119    # Remove temporary files 
     120    os.remove(compDir + '.' + outputFileName_scd + '.tmp') 
    103121    data = doc_scd.toxml('UTF-8') 
    104122    xmlBeautify.beautify(data,compDir + '.' + outputFileName_scd + '.tmp') 
     
    116134    postProcessed_scd.close() 
    117135 
     136 
    118137    # Remove temporary files 
    119138    os.remove(compDir + '.' + outputFileName_scd + '.tmp') 
     139 
    120140 
    121141 
     
    158178    #outputFileName_spd = comp.name + 'Resource' + '.spd.xml' 
    159179 
    160     # Define <!DOCTYPE> here (overriding template if necessary) 
    161     ensureDocType(doc_spd, u'softpkg', u'../dtd/softpkg.dtd') 
    162180    data = doc_spd.toxml('UTF-8') 
    163181    xmlBeautify.beautify(data,compDir + '.' + outputFileName_spd + '.tmp') 
     182    data = doc_spd.toxml('UTF-8') 
     183    xmlBeautify.beautify(data,compDir + '.' + outputFileName_spd + '.tmp') 
     184 
    164185 
    165186    preProcessed_spd = open(compDir + '.' + outputFileName_spd + '.tmp', 'r') 
     
    170191    remaining = preProcessed_spd.readlines() 
    171192    postProcessed_spd.writelines(line0) 
    172     #postProcessed_spd.writelines(u'<!DOCTYPE softpkg SYSTEM \"../dtd/softpkg.dtd\">\n') 
     193    postProcessed_spd.writelines(u'<!DOCTYPE softpkg SYSTEM \"../dtd/softpkg.dtd\">\n') 
    173194    postProcessed_spd.writelines(commentLine) 
    174195    postProcessed_spd.writelines(remaining) 
     
    177198    # Remove temporary files 
    178199    os.remove(compDir + '.' + outputFileName_spd + '.tmp') 
     200 
    179201 
    180202def gen_prf(comp, waveformDir, wavedevPath): 
     
    270292    #outputFileName_prf = comp.name + 'Resource' + '.prf.xml' 
    271293 
    272     # Define <!DOCTYPE> here (overriding template if necessary) 
    273     ensureDocType(doc_prf, u'properties', u'../dtd/properties.dtd') 
    274294    data = doc_prf.toxml('UTF-8') 
    275295    xmlBeautify.beautify(data,compDir + '.' + outputFileName_prf + '.tmp') 
     296    data = doc_prf.toxml('UTF-8') 
     297    xmlBeautify.beautify(data,compDir + '.' + outputFileName_prf + '.tmp') 
    276298 
    277299    preProcessed_prf = open(compDir + '.' + outputFileName_prf + '.tmp', 'r') 
    278300    postProcessed_prf = open(compDir + outputFileName_prf, 'w') 
     301 
    279302 
    280303    # Specify external DTD 
     
    282305    remaining = preProcessed_prf.readlines() 
    283306    postProcessed_prf.writelines(line0) 
    284     #postProcessed_prf.writelines(u'<!DOCTYPE properties SYSTEM \"../dtd/properties.dtd\">\n') 
     307    postProcessed_prf.writelines(u'<!DOCTYPE properties SYSTEM \"../dtd/properties.dtd\">\n') 
    285308    postProcessed_prf.writelines(commentLine) 
    286309    postProcessed_prf.writelines(remaining) 
    287310    postProcessed_prf.close() 
    288311 
     312 
    289313    # Remove temporary files 
    290314    os.remove(compDir + '.' + outputFileName_prf + '.tmp') 
    291  
    292 def ensureDocType(xmldoc, name, systemId): 
    293     # Define <!DOCTYPE> here (overriding template if necessary) 
    294     if xmldoc.doctype == None: 
    295         xmldoc.doctype = xml.dom.minidom.DocumentType(name) 
    296         xmldoc.insertBefore(xmldoc.doctype, xmldoc.firstChild) 
    297     xmldoc.doctype.name = name 
    298     xmldoc.doctype.systemId = systemId 
  • ossiedev/trunk/tools/WaveDev/wavedev/XML_gen/xmlBeautify.py

    r4961 r8114  
    2626    if len(output) > 0: 
    2727        sys.stdout = open(output,'w') 
    28          
    29     myprint = sys.stdout.write  
    30          
     28 
     29    myprint = sys.stdout.write 
     30 
    3131    fields = re.split('(<.*?>)',data) 
    3232    #remove any lone instances of '\n' or '\t' or pure whitespace strings 
     
    6161 
    6262    if len(output) > 0: 
     63        print '' 
    6364        sys.stdout = store_stdout 
    6465