X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FPython%2Fcalcdeps.py;h=a0afa3f432c15853ba01d167e2bd12e80fb1f03b;hp=7742cf9cdc0194a105dbbe677e4c99ade4ebac4b;hb=09d4d22408847655f3aa5d987304b9a32e17fbb4;hpb=1a137e9826055eb8cfce77913e47e0d082ca27d0 diff --git a/Tools/Python/calcdeps.py b/Tools/Python/calcdeps.py old mode 100644 new mode 100755 index 7742cf9cdc..a0afa3f432 --- a/Tools/Python/calcdeps.py +++ b/Tools/Python/calcdeps.py @@ -1,10 +1,11 @@ -#!env python +#!/usr/bin/env python """Calculate the dependencies a given module has by looking through the source code to see what guids and functions are referenced to see which Packages and Library Classes need to be referenced. """ import os, sys, re, getopt, string, glob, xml.dom.minidom, pprint +from XmlRoutines import * # Map each function name back to the lib class that declares it. function_table = {} @@ -12,43 +13,6 @@ function_table = {} # Map each guid name to a package name. cname_table = {} -def XmlList(Dom, String): - """Get a list of XML Elements using XPath style syntax.""" - if Dom.nodeType==Dom.DOCUMENT_NODE: - return XmlList(Dom.documentElement, String) - if String[0] == "/": - return XmlList(Dom, String[1:]) - if String == "" : - return [] - TagList = String.split('/') - nodes = [] - if Dom.nodeType == Dom.ELEMENT_NODE and Dom.tagName.strip() == TagList[0]: - if len(TagList) == 1: - nodes = [Dom] - else: - restOfPath = "/".join(TagList[1:]) - for child in Dom.childNodes: - nodes = nodes + XmlList(child, restOfPath) - return nodes - -def XmlElement (Dom, String): - """Return a single element that matches the String which is XPath style syntax.""" - try: - return XmlList (Dom, String)[0].firstChild.data.strip(' ') - except: - return '' - -def XmlElementData (Dom): - """Get the text for this element.""" - return Dom.firstChild.data.strip(' ') - -def XmlAttribute (Dom, String): - """Return a single attribute that named by String.""" - try: - return Dom.getAttribute(String) - except: - return '' - def inWorkspace(rel_path): """Treat the given path as relative to the workspace."""