summaryrefslogtreecommitdiff
path: root/Tools/Python/ListWorkspace.py
blob: 1a1c9deaefbc828caf38b86a47dcf4b89e5375a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python

"""List the contents of the Framework Database to the screen in a readble
form."""

import os, sys, getopt, string, xml.dom.minidom, zipfile, md5
from XmlRoutines import *
from WorkspaceRoutines import *

def openDatabase(f):

  print "Dumping the contents of %s workspace database file." % f

  db = xml.dom.minidom.parse(inWorkspace(f))

  return db

def showSpds(db):

  print "--------\nPackages\n--------"

  for spdFile in XmlList(db, "/FrameworkDatabase/PackageList/Filename"):
    spdFileName = XmlElementData(spdFile)
    spd = xml.dom.minidom.parse(inWorkspace(spdFileName))
    spdName = XmlElement(spd, "/PackageSurfaceArea/SpdHeader/PackageName")

    print "  %-24s %-10s" % (spdName, spdFileName)

def showFpds(db):

  print "--------\nPlatforms\n--------"

  for fpdFile in XmlList(db, "/FrameworkDatabase/PlatformList/Filename"):
    fpdFileName = XmlElementData(fpdFile)
    fpd = xml.dom.minidom.parse(inWorkspace(fpdFileName))
    fpdName = XmlElement(fpd, "/PlatformSurfaceArea/PlatformHeader/PlatformName")

    print "  %-24s %-10s" % (fpdName, fpdFileName)

# This acts like the main() function for the script, unless it is 'import'ed
# into another script.
if __name__ == '__main__':

  db = openDatabase("Tools/Conf/FrameworkDatabase.db")

  showSpds(db)
  showFpds(db)