]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Python/MkFar.py
Add license header to Python files.
[mirror_edk2.git] / Tools / Python / MkFar.py
index 327c81a94a28e3033128fbb91ab7f5ed5ce64f43..9c6cc5de55a191de02cf8b24903c9bffb3b1973e 100755 (executable)
@@ -1,5 +1,8 @@
 #!/usr/bin/env python
 
+"""This is a python script that takes user input from the command line and
+creates a far (Framework Archive Manifest) file for distribution."""
+
 import os, sys, getopt, string, xml.dom.minidom, zipfile, md5
 from XmlRoutines import *
 from WorkspaceRoutines import *
@@ -20,9 +23,13 @@ class Far:
     far.ExtraFiles=[]
 
 far = Far()
+"""The far object is constructed from the template file the user passed in."""
 
 def parseMsa(msaFile, spdDir):
 
+  """ XXX Parse an msa file and return a list of all the files that this msa
+  includes."""
+
   filelist = [msaFile]
 
   msaDir = os.path.dirname(msaFile)
@@ -41,6 +48,9 @@ def parseMsa(msaFile, spdDir):
 
 def parseSpd(spdFile):
 
+  """Parse an spd file and return a list of all the files that this spd
+  includes."""
+
   files = []
 
   spdDir = os.path.dirname(spdFile)
@@ -75,6 +85,9 @@ def parseSpd(spdFile):
 
 def makeFarHeader(doc):
 
+  """Create a dom tree for the Far Header. It will use information from the
+  template file passed on the command line, if present."""
+
   header = doc.createElement("FarHeader")
   name = doc.createElement("FarName")
   name.appendChild(doc.createTextNode(far.FarName))
@@ -105,6 +118,8 @@ def makeFarHeader(doc):
 
 def getSpdGuidVersion(spdFile):
 
+  """Returns a tuple (guid, version) which is read from the given spdFile."""
+
   spd = xml.dom.minidom.parse(inWorkspace(spdFile))
 
   return (XmlElement(spd, "/PackageSurfaceArea/SpdHeader/GuidValue"),
@@ -112,6 +127,8 @@ def getSpdGuidVersion(spdFile):
 
 def makeFar(files, farname):
 
+  """Make a far out of the given filelist and writes it to the file farname."""
+
   domImpl = xml.dom.minidom.getDOMImplementation()
   man = domImpl.createDocument(None, "FrameworkArchiveManifest", None)
   top_element = man.documentElement
@@ -197,6 +214,10 @@ def makeFar(files, farname):
   return
 
 def farFileNode(doc, filename):
+
+  """This is a function that returns a dom tree for a given file that is
+  included in the far. An md5sum is calculated for that file."""
+
   content = doc.createElement("FarFilename")
   f=open(filename, "rb")
   content.setAttribute("Md5sum", md5.md5(f.read()).hexdigest())