* 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:
+7
-7
@@ -47,7 +47,7 @@ class UpdateInfo:
|
|||||||
node = xml.newNode("Update")
|
node = xml.newNode("Update")
|
||||||
xml.addTextNodeUnder(node, "Date", self.date)
|
xml.addTextNodeUnder(node, "Date", self.date)
|
||||||
xml.addTextNodeUnder(node, "Version", self.version)
|
xml.addTextNodeUnder(node, "Version", self.version)
|
||||||
xml.addTextNodeUndeR(node, "Release", self.release)
|
xml.addTextNodeUnder(node, "Release", self.release)
|
||||||
return node
|
return node
|
||||||
|
|
||||||
class PathInfo:
|
class PathInfo:
|
||||||
@@ -83,12 +83,12 @@ class PackageInfo:
|
|||||||
xml.addTextNodeUnder(node, "Summary", self.summary)
|
xml.addTextNodeUnder(node, "Summary", self.summary)
|
||||||
xml.addTextNodeUnder(node, "Description", self.description)
|
xml.addTextNodeUnder(node, "Description", self.description)
|
||||||
xml.addTextNodeUnder(node, "Category", self.category)
|
xml.addTextNodeUnder(node, "Category", self.category)
|
||||||
for dep in map(lambda x : x.elt(self), self.installDeps):
|
for dep in map(lambda x : x.elt(xml), self.installDeps):
|
||||||
self.addNode("Source/InstallDependencies", dep)
|
xml.addNode("Source/InstallDependencies", dep)
|
||||||
for dep in map(lambda x : x.elt(self), self.runtimeDeps):
|
for dep in map(lambda x : x.elt(xml), self.runtimeDeps):
|
||||||
self.addNode("Source/RuntimeDependencies", dep)
|
xml.addNode("Source/RuntimeDependencies", dep)
|
||||||
for path in map(lambda x : x.elt(self), self.paths):
|
for path in map(lambda x : x.elt(xml), self.paths):
|
||||||
self.addNode("Files", dep)
|
xml.addNode("Files", dep)
|
||||||
return node
|
return node
|
||||||
|
|
||||||
class SpecFile(XmlFile):
|
class SpecFile(XmlFile):
|
||||||
|
|||||||
+4
-2
@@ -39,7 +39,8 @@ def getChildElts(node):
|
|||||||
|
|
||||||
def getNode(node, tagpath):
|
def getNode(node, tagpath):
|
||||||
"""returns the *first* matching node for given tag path."""
|
"""returns the *first* matching node for given tag path."""
|
||||||
|
|
||||||
|
assert type(tagpath)==str
|
||||||
tags = tagpath.split('/')
|
tags = tagpath.split('/')
|
||||||
assert len(tags)>0
|
assert len(tags)>0
|
||||||
|
|
||||||
@@ -108,7 +109,8 @@ def addTagPath(dom, node, tags, newnode=None):
|
|||||||
|
|
||||||
def addNode(dom, node, tagpath, newnode = None):
|
def addNode(dom, node, tagpath, newnode = None):
|
||||||
"""add a new node at the end of the tree"""
|
"""add a new node at the end of the tree"""
|
||||||
|
|
||||||
|
assert type(tagpath)==str
|
||||||
tags = tagpath.split('/') # tag chain
|
tags = tagpath.split('/') # tag chain
|
||||||
assert len(tags)>0 # we want a chain
|
assert len(tags)>0 # we want a chain
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -112,7 +112,6 @@ class XmlFile(object):
|
|||||||
|
|
||||||
def addTextNodeUnder(self, node, tagPath, text):
|
def addTextNodeUnder(self, node, tagPath, text):
|
||||||
"add a text node under given node with tag path (phew)"
|
"add a text node under given node with tag path (phew)"
|
||||||
node = self.addNodeUnder(tagPath, self.newTextNode(text))
|
return self.addNodeUnder(node, tagPath, self.newTextNode(text))
|
||||||
return node
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user