Changeset 8114
- Timestamp:
- 07/31/08 13:20:38 (5 years ago)
- Location:
- ossiedev/trunk/tools/WaveDev/wavedev
- Files:
-
- 3 modified
- 2 copied
-
XML_gen/application_gen.py (modified) (11 diffs)
-
XML_gen/component_gen.py (modified) (8 diffs)
-
XML_gen/xmlBeautify.py (modified) (2 diffs)
-
cfg.py (copied) (copied from ossiedev/branches/jsnyder/ComponentProject/WaveDev/wavedev/cfg.py)
-
uuidgen.py (copied) (copied from ossiedev/branches/jsnyder/ComponentProject/WaveDev/wavedev/uuidgen.py)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/trunk/tools/WaveDev/wavedev/XML_gen/application_gen.py
r8112 r8114 22 22 import shutil 23 23 import component_gen 24 from component_gen import ensureDocType25 24 import xml.dom.minidom 26 25 from xml.dom.minidom import Node … … 30 29 31 30 32 commentLine = u'<!--Created with OSSIE WaveDev ' \ 33 + u'-->\n<!--Powered by Python-->\n' 31 32 33 commentLine = u'<!-- Created with OSSIE WaveDev-->\n<!--Powered by Python-->\n' 34 34 35 xmlpath = u'/xml/' 35 36 ####################################################################### … … 273 274 assemblycontrollerNode.getElementsByTagName("componentinstantiationref")[0].setAttribute("refid", assemblycontroller_id) 274 275 275 # Define <!DOCTYPE> here (overriding template if necessary)276 ensureDocType(doc_sad, u'softwareassembly', u'../../xml/dtd/softwareassembly.dtd')277 278 276 # Create and beautify the SAD file as a temporary file 279 277 data = doc_sad.toxml('UTF-8') … … 281 279 282 280 # Post Processing - add some of the header lines 281 283 282 284 283 preProcessed_sad = open(waveformDir + '.' + outputFilename_sad + '.tmp', 'r') … … 289 288 remaining = preProcessed_sad.readlines() 290 289 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') 292 291 postProcessed_sad.writelines(commentLine) 293 292 postProcessed_sad.writelines(remaining) … … 296 295 # Remove temporary files 297 296 os.remove(waveformDir + '.' + outputFilename_sad + '.tmp') 297 298 298 299 299 ####################### … … 343 343 deviceassignmentsequenceNode.appendChild(deviceassignmenttypeNode) 344 344 345 # Define <!DOCTYPE> here (overriding template if necessary)346 # ensureDocType(das, u'deploymentenforcement', u'../../xml/dtd/deploymentenforcement.dtd')347 345 data = das.toxml('UTF-8') 348 346 xmlBeautify.beautify(data,path+'.'+waveName+'_DAS.xml.tmp') 347 348 349 349 350 350 # Post Processing - add some of the header lines … … 365 365 os.remove(path+'.'+waveName+'_DAS.xml.tmp') 366 366 367 367 368 ################################################################################ 368 369 # Generate the DeviceManager XML files … … 391 392 localfileNode.setAttribute("name", unicode(dmName) + u'.scd.xml') 392 393 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') 395 396 data = doc_spd.toxml('UTF-8') 396 397 xmlBeautify.beautify(data,path + '.' + outputFilename_spd + '.tmp') … … 414 415 os.remove(path + '.' + outputFilename_spd + '.tmp') 415 416 417 416 418 #tempDM = CC.Component(dmName,generate=False) 417 419 #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 418 442 419 443 # Copy the scd and prf files to directory - these aren't changed yet … … 482 506 partitioningNode.appendChild(componentplacementNode) 483 507 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') 486 511 # Create and beautify the dcd file as a temporary file 487 512 data = doc_dcd.toxml('UTF-8') -
ossiedev/trunk/tools/WaveDev/wavedev/XML_gen/component_gen.py
r8112 r8114 24 24 import xml.dom.minidom 25 25 from xml.dom.minidom import Node 26 26 27 import xmlBeautify 27 28 import uuidgen 28 29 29 30 31 30 32 xmlpath = u'xml/' 31 33 binpath = u'bin/' 32 34 33 commentLine = u'<!--Created with OSSIE WaveDev ' + u'-->\n<!--Powered by Python-->\n' 35 36 commentLine = u'<!--Created with OSSIE WaveDev-->\n<!--Powered by Python-->\n' 34 37 35 38 def gen_scd(comp, waveformDir, wavedevPath): … … 99 102 outputFileName_scd = comp.name + '.scd.xml' 100 103 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') 103 121 data = doc_scd.toxml('UTF-8') 104 122 xmlBeautify.beautify(data,compDir + '.' + outputFileName_scd + '.tmp') … … 116 134 postProcessed_scd.close() 117 135 136 118 137 # Remove temporary files 119 138 os.remove(compDir + '.' + outputFileName_scd + '.tmp') 139 120 140 121 141 … … 158 178 #outputFileName_spd = comp.name + 'Resource' + '.spd.xml' 159 179 160 # Define <!DOCTYPE> here (overriding template if necessary)161 ensureDocType(doc_spd, u'softpkg', u'../dtd/softpkg.dtd')162 180 data = doc_spd.toxml('UTF-8') 163 181 xmlBeautify.beautify(data,compDir + '.' + outputFileName_spd + '.tmp') 182 data = doc_spd.toxml('UTF-8') 183 xmlBeautify.beautify(data,compDir + '.' + outputFileName_spd + '.tmp') 184 164 185 165 186 preProcessed_spd = open(compDir + '.' + outputFileName_spd + '.tmp', 'r') … … 170 191 remaining = preProcessed_spd.readlines() 171 192 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') 173 194 postProcessed_spd.writelines(commentLine) 174 195 postProcessed_spd.writelines(remaining) … … 177 198 # Remove temporary files 178 199 os.remove(compDir + '.' + outputFileName_spd + '.tmp') 200 179 201 180 202 def gen_prf(comp, waveformDir, wavedevPath): … … 270 292 #outputFileName_prf = comp.name + 'Resource' + '.prf.xml' 271 293 272 # Define <!DOCTYPE> here (overriding template if necessary)273 ensureDocType(doc_prf, u'properties', u'../dtd/properties.dtd')274 294 data = doc_prf.toxml('UTF-8') 275 295 xmlBeautify.beautify(data,compDir + '.' + outputFileName_prf + '.tmp') 296 data = doc_prf.toxml('UTF-8') 297 xmlBeautify.beautify(data,compDir + '.' + outputFileName_prf + '.tmp') 276 298 277 299 preProcessed_prf = open(compDir + '.' + outputFileName_prf + '.tmp', 'r') 278 300 postProcessed_prf = open(compDir + outputFileName_prf, 'w') 301 279 302 280 303 # Specify external DTD … … 282 305 remaining = preProcessed_prf.readlines() 283 306 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') 285 308 postProcessed_prf.writelines(commentLine) 286 309 postProcessed_prf.writelines(remaining) 287 310 postProcessed_prf.close() 288 311 312 289 313 # Remove temporary files 290 314 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 = name298 xmldoc.doctype.systemId = systemId -
ossiedev/trunk/tools/WaveDev/wavedev/XML_gen/xmlBeautify.py
r4961 r8114 26 26 if len(output) > 0: 27 27 sys.stdout = open(output,'w') 28 29 myprint = sys.stdout.write 30 28 29 myprint = sys.stdout.write 30 31 31 fields = re.split('(<.*?>)',data) 32 32 #remove any lone instances of '\n' or '\t' or pure whitespace strings … … 61 61 62 62 if len(output) > 0: 63 print '' 63 64 sys.stdout = store_stdout 64 65