-def makeFar(filelist, farname):
-
- man = \
-"""<?xml version="1.0" encoding="UTF-8"?>
-<FrameworkArchiveManifest>
-</FrameworkArchiveManifest>
-"""
- zip = zipfile.ZipFile(farname, "w")
- for file in args:
- if not os.path.exists(inWorkspace(file)):
- print "Skipping non-existent file '%s'." % file
- (_, extension) = os.path.splitext(file)
+ """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"),
+ XmlElement(spd, "/PackageSurfaceArea/SpdHeader/Version"))
+
+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
+
+ top_element.appendChild(makeFarHeader(man))
+
+ packList = XmlAppendChildElement(top_element, "FarPackageList")
+ platList = XmlAppendChildElement(top_element, "FarPlatformList")
+ contents = XmlAppendChildElement(top_element, "Contents")
+ XmlAppendChildElement(top_element, "UserExtensions")
+
+ try:
+ zip = zipfile.ZipFile(farname, "w", zipfile.ZIP_DEFLATED)
+ except:
+ zip = zipfile.ZipFile(farname, "w", zipfile.ZIP_STORED)
+ for infile in set(files):
+ if not os.path.exists(inWorkspace(infile)):
+ print "Error: Non-existent file '%s'." % infile
+ sys.exit()
+ (_, extension) = os.path.splitext(infile)