* bir takim arguman gecme hatalari duzelt

* addNode / getNode'a bir iki assert ekle
* specfile testini geciyoruz ve hatta canavar gibi bir specfile
  output'umuz var simdi (ama indented falan degil :/)
This commit is contained in:
Eray Özkural
2005-06-22 13:44:21 +00:00
parent fdcf2ffef1
commit 6eaa839791
3 changed files with 12 additions and 11 deletions
+7 -7
View File
@@ -47,7 +47,7 @@ class UpdateInfo:
node = xml.newNode("Update")
xml.addTextNodeUnder(node, "Date", self.date)
xml.addTextNodeUnder(node, "Version", self.version)
xml.addTextNodeUndeR(node, "Release", self.release)
xml.addTextNodeUnder(node, "Release", self.release)
return node
class PathInfo:
@@ -83,12 +83,12 @@ class PackageInfo:
xml.addTextNodeUnder(node, "Summary", self.summary)
xml.addTextNodeUnder(node, "Description", self.description)
xml.addTextNodeUnder(node, "Category", self.category)
for dep in map(lambda x : x.elt(self), self.installDeps):
self.addNode("Source/InstallDependencies", dep)
for dep in map(lambda x : x.elt(self), self.runtimeDeps):
self.addNode("Source/RuntimeDependencies", dep)
for path in map(lambda x : x.elt(self), self.paths):
self.addNode("Files", dep)
for dep in map(lambda x : x.elt(xml), self.installDeps):
xml.addNode("Source/InstallDependencies", dep)
for dep in map(lambda x : x.elt(xml), self.runtimeDeps):
xml.addNode("Source/RuntimeDependencies", dep)
for path in map(lambda x : x.elt(xml), self.paths):
xml.addNode("Files", dep)
return node
class SpecFile(XmlFile):
+4 -2
View File
@@ -39,7 +39,8 @@ def getChildElts(node):
def getNode(node, tagpath):
"""returns the *first* matching node for given tag path."""
assert type(tagpath)==str
tags = tagpath.split('/')
assert len(tags)>0
@@ -108,7 +109,8 @@ def addTagPath(dom, node, tags, newnode=None):
def addNode(dom, node, tagpath, newnode = None):
"""add a new node at the end of the tree"""
assert type(tagpath)==str
tags = tagpath.split('/') # tag chain
assert len(tags)>0 # we want a chain
+1 -2
View File
@@ -112,7 +112,6 @@ class XmlFile(object):
def addTextNodeUnder(self, node, tagPath, text):
"add a text node under given node with tag path (phew)"
node = self.addNodeUnder(tagPath, self.newTextNode(text))
return node
return self.addNodeUnder(node, tagPath, self.newTextNode(text))