* autoxml: remove redundant xml args
* fix: print graph only in debug mode
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE Project SYSTEM "Project-3.8.dtd">
|
<!DOCTYPE Project SYSTEM "Project-3.8.dtd">
|
||||||
<!-- Project file for project pisi -->
|
<!-- Project file for project pisi -->
|
||||||
<!-- Saved: 2005-11-03, 20:18:56 -->
|
<!-- Saved: 2005-11-03, 22:44:51 -->
|
||||||
<!-- Copyright (C) 2005 PiSi Development Team, pisi@uludag.org.tr -->
|
<!-- Copyright (C) 2005 PiSi Development Team, pisi@uludag.org.tr -->
|
||||||
<Project version="3.8">
|
<Project version="3.8">
|
||||||
<ProgLanguage mixed="0">Python</ProgLanguage>
|
<ProgLanguage mixed="0">Python</ProgLanguage>
|
||||||
@@ -378,8 +378,8 @@
|
|||||||
<Name>specfileoldtests.py</Name>
|
<Name>specfileoldtests.py</Name>
|
||||||
</Source>
|
</Source>
|
||||||
<Source>
|
<Source>
|
||||||
<Dir>pisi</Dir>
|
<Dir>tests</Dir>
|
||||||
<Name>specfileold.py</Name>
|
<Name>filestests.py</Name>
|
||||||
</Source>
|
</Source>
|
||||||
</Sources>
|
</Sources>
|
||||||
<Forms>
|
<Forms>
|
||||||
@@ -422,10 +422,10 @@
|
|||||||
<VcsOtherData>{'standardLayout': 1}</VcsOtherData>
|
<VcsOtherData>{'standardLayout': 1}</VcsOtherData>
|
||||||
</Vcs>
|
</Vcs>
|
||||||
<FiletypeAssociations>
|
<FiletypeAssociations>
|
||||||
<FiletypeAssociation pattern="*.ui.h" type="FORMS" />
|
|
||||||
<FiletypeAssociation pattern="*.ui" type="FORMS" />
|
|
||||||
<FiletypeAssociation pattern="*.idl" type="INTERFACES" />
|
|
||||||
<FiletypeAssociation pattern="*.ptl" type="SOURCES" />
|
|
||||||
<FiletypeAssociation pattern="*.py" type="SOURCES" />
|
<FiletypeAssociation pattern="*.py" type="SOURCES" />
|
||||||
|
<FiletypeAssociation pattern="*.ui.h" type="FORMS" />
|
||||||
|
<FiletypeAssociation pattern="*.idl" type="INTERFACES" />
|
||||||
|
<FiletypeAssociation pattern="*.ui" type="FORMS" />
|
||||||
|
<FiletypeAssociation pattern="*.ptl" type="SOURCES" />
|
||||||
</FiletypeAssociations>
|
</FiletypeAssociations>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
+1
-4
@@ -157,25 +157,22 @@ def configure_pending():
|
|||||||
# start with pending packages
|
# start with pending packages
|
||||||
# configure them in reverse topological order of dependency
|
# configure them in reverse topological order of dependency
|
||||||
A = ctx.installdb.list_pending()
|
A = ctx.installdb.list_pending()
|
||||||
#print A
|
|
||||||
G_f = pgraph.PGraph(packagedb) # construct G_f
|
G_f = pgraph.PGraph(packagedb) # construct G_f
|
||||||
for x in A:
|
for x in A:
|
||||||
G_f.add_package(x)
|
G_f.add_package(x)
|
||||||
B = A
|
B = A
|
||||||
#state = {}
|
|
||||||
while len(B) > 0:
|
while len(B) > 0:
|
||||||
Bp = set()
|
Bp = set()
|
||||||
for x in B:
|
for x in B:
|
||||||
pkg = packagedb.get_package(x)
|
pkg = packagedb.get_package(x)
|
||||||
#print pkg
|
|
||||||
for dep in pkg.runtimeDependencies:
|
for dep in pkg.runtimeDependencies:
|
||||||
if dep.package in G_f.vertices():
|
if dep.package in G_f.vertices():
|
||||||
G_f.add_dep(x, dep)
|
G_f.add_dep(x, dep)
|
||||||
B = Bp
|
B = Bp
|
||||||
|
if ctx.get_option('debug'):
|
||||||
G_f.write_graphviz(sys.stdout)
|
G_f.write_graphviz(sys.stdout)
|
||||||
order = G_f.topological_sort()
|
order = G_f.topological_sort()
|
||||||
order.reverse()
|
order.reverse()
|
||||||
#print order
|
|
||||||
try:
|
try:
|
||||||
import pisi.comariface as comariface
|
import pisi.comariface as comariface
|
||||||
for x in order:
|
for x in order:
|
||||||
|
|||||||
+20
-20
@@ -102,7 +102,7 @@ class LocalText(dict):
|
|||||||
lang = 'en'
|
lang = 'en'
|
||||||
self[lang] = c
|
self[lang] = c
|
||||||
|
|
||||||
def encode(self, xml, node, errs):
|
def encode(self, node, errs):
|
||||||
assert self.tag != ''
|
assert self.tag != ''
|
||||||
for key in self.iterkeys():
|
for key in self.iterkeys():
|
||||||
newnode = newNode(node, self.tag)
|
newnode = newNode(node, self.tag)
|
||||||
@@ -321,13 +321,13 @@ class autoxml(oo.autosuper, oo.autoprop):
|
|||||||
cls.decode = decode
|
cls.decode = decode
|
||||||
|
|
||||||
cls.encoders = encoders
|
cls.encoders = encoders
|
||||||
def encode(self, xml, node, errs):
|
def encode(self, node, errs):
|
||||||
for base in cls.autoxml_bases:
|
for base in cls.autoxml_bases:
|
||||||
base.encode(self, xml, node, errs)
|
base.encode(self, node, errs)
|
||||||
for encode_member in encoders:#self.__class__.encoders:
|
for encode_member in encoders:#self.__class__.encoders:
|
||||||
encode_member(self, xml, node, errs)
|
encode_member(self, node, errs)
|
||||||
if hasattr(self, 'encode_hook'):
|
if hasattr(self, 'encode_hook'):
|
||||||
self.encode_hook(xml, node, errs)
|
self.encode_hook(node, errs)
|
||||||
cls.encode = encode
|
cls.encode = encode
|
||||||
|
|
||||||
cls.errorss = errorss
|
cls.errorss = errorss
|
||||||
@@ -406,7 +406,7 @@ class autoxml(oo.autosuper, oo.autoprop):
|
|||||||
raise Error(*errs)
|
raise Error(*errs)
|
||||||
errs = []
|
errs = []
|
||||||
self.newDOM()
|
self.newDOM()
|
||||||
self.encode(self, self.rootNode(), errs)
|
self.encode(self.rootNode(), errs)
|
||||||
if hasattr(self, 'write_hook'):
|
if hasattr(self, 'write_hook'):
|
||||||
self.write_hook(errs)
|
self.write_hook(errs)
|
||||||
if errs:
|
if errs:
|
||||||
@@ -426,7 +426,7 @@ class autoxml(oo.autosuper, oo.autoprop):
|
|||||||
assert type(tag_type) == type(type)
|
assert type(tag_type) == type(type)
|
||||||
def readtext(node, attr):
|
def readtext(node, attr):
|
||||||
return getNodeAttribute(node, attr)
|
return getNodeAttribute(node, attr)
|
||||||
def writetext(xml, node, attr, text):
|
def writetext(node, attr, text):
|
||||||
#print 'write attr', attr, text
|
#print 'write attr', attr, text
|
||||||
node.setAttribute(attr, text)
|
node.setAttribute(attr, text)
|
||||||
anonfuns = cls.gen_anon_basic(attr, spec, readtext, writetext)
|
anonfuns = cls.gen_anon_basic(attr, spec, readtext, writetext)
|
||||||
@@ -447,9 +447,9 @@ class autoxml(oo.autosuper, oo.autoprop):
|
|||||||
def readtext(node, tagpath):
|
def readtext(node, tagpath):
|
||||||
#print 'read tag', node, tagpath
|
#print 'read tag', node, tagpath
|
||||||
return getNodeText(node, tagpath)
|
return getNodeText(node, tagpath)
|
||||||
def writetext(xml, node, tagpath, text):
|
def writetext(node, tagpath, text):
|
||||||
#print 'write tag', node, tagpath, text
|
#print 'write tag', node, tagpath, text
|
||||||
xml.addTextNodeUnder(node, tagpath, text)
|
addText(node, tagpath, text)
|
||||||
return cls.gen_anon_basic(tag, spec, readtext, writetext)
|
return cls.gen_anon_basic(tag, spec, readtext, writetext)
|
||||||
elif type(tag_type) is types.ListType:
|
elif type(tag_type) is types.ListType:
|
||||||
return cls.gen_list_tag(tag, spec)
|
return cls.gen_list_tag(tag, spec)
|
||||||
@@ -469,7 +469,7 @@ class autoxml(oo.autosuper, oo.autoprop):
|
|||||||
def readtext(node, blah):
|
def readtext(node, blah):
|
||||||
node.normalize()
|
node.normalize()
|
||||||
return getNodeText(node)
|
return getNodeText(node)
|
||||||
def writetext(xml, node, blah, text):
|
def writetext(node, blah, text):
|
||||||
addText(node, "", text)
|
addText(node, "", text)
|
||||||
anonfuns = cls.gen_anon_basic(token, spec, readtext, writetext)
|
anonfuns = cls.gen_anon_basic(token, spec, readtext, writetext)
|
||||||
return cls.gen_named_comp(token, spec, anonfuns)
|
return cls.gen_named_comp(token, spec, anonfuns)
|
||||||
@@ -490,13 +490,13 @@ class autoxml(oo.autosuper, oo.autoprop):
|
|||||||
"""decode component from DOM node"""
|
"""decode component from DOM node"""
|
||||||
setattr(self, name, decode_a(node, errs, where + unicode(name) + " "))
|
setattr(self, name, decode_a(node, errs, where + unicode(name) + " "))
|
||||||
|
|
||||||
def encode(self, xml, node, errs):
|
def encode(self, node, errs):
|
||||||
"""encode self inside, possibly new, DOM node using xml"""
|
"""encode self inside, possibly new, DOM node using xml"""
|
||||||
if hasattr(self, name):
|
if hasattr(self, name):
|
||||||
value = getattr(self, name)
|
value = getattr(self, name)
|
||||||
else:
|
else:
|
||||||
value = None
|
value = None
|
||||||
encode_a(xml, node, value, errs)
|
encode_a(node, value, errs)
|
||||||
|
|
||||||
def errors(self, where):
|
def errors(self, where):
|
||||||
errs = []
|
errs = []
|
||||||
@@ -587,10 +587,10 @@ class autoxml(oo.autosuper, oo.autoprop):
|
|||||||
errs.append(where + _('Mandatory token %s not available') % token)
|
errs.append(where + _('Mandatory token %s not available') % token)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def encode(xml, node, value, errs):
|
def encode(node, value, errs):
|
||||||
"""encode given value inside DOM node"""
|
"""encode given value inside DOM node"""
|
||||||
if value:
|
if value:
|
||||||
writetext(xml, node, token, unicode(value))
|
writetext(node, token, unicode(value))
|
||||||
else:
|
else:
|
||||||
if req == mandatory:
|
if req == mandatory:
|
||||||
errs.append(_('Mandatory token %s not available') % token)
|
errs.append(_('Mandatory token %s not available') % token)
|
||||||
@@ -634,12 +634,12 @@ class autoxml(oo.autosuper, oo.autoprop):
|
|||||||
errs.append(where + _('Mandatory argument not available'))
|
errs.append(where + _('Mandatory argument not available'))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def encode(xml, node, obj, errs):
|
def encode(node, obj, errs):
|
||||||
if node and obj:
|
if node and obj:
|
||||||
try:
|
try:
|
||||||
#FIXME: this doesn't look pretty
|
#FIXME: this doesn't look pretty
|
||||||
classnode = node.ownerDocument.createElement(tag)
|
classnode = node.ownerDocument.createElement(tag)
|
||||||
obj.encode(xml, classnode, errs)
|
obj.encode(classnode, errs)
|
||||||
node.appendChild(classnode)
|
node.appendChild(classnode)
|
||||||
except Error:
|
except Error:
|
||||||
if req == mandatory:
|
if req == mandatory:
|
||||||
@@ -690,7 +690,7 @@ class autoxml(oo.autosuper, oo.autoprop):
|
|||||||
l.append(decode_item(dummy, errs, where + unicode("[%s]" % ix)))
|
l.append(decode_item(dummy, errs, where + unicode("[%s]" % ix)))
|
||||||
return l
|
return l
|
||||||
|
|
||||||
def encode(xml, node, l, errs):
|
def encode(node, l, errs):
|
||||||
dom = node.ownerDocument
|
dom = node.ownerDocument
|
||||||
if l and len(l) > 0:
|
if l and len(l) > 0:
|
||||||
for item in l:
|
for item in l:
|
||||||
@@ -698,7 +698,7 @@ class autoxml(oo.autosuper, oo.autoprop):
|
|||||||
listnode = addNode(node, list_tagpath)
|
listnode = addNode(node, list_tagpath)
|
||||||
else:
|
else:
|
||||||
listnode = node
|
listnode = node
|
||||||
encode_item(xml, listnode, item, errs)
|
encode_item(listnode, item, errs)
|
||||||
else:
|
else:
|
||||||
if req is mandatory:
|
if req is mandatory:
|
||||||
errs.append(_('Mandatory list empty'))
|
errs.append(_('Mandatory list empty'))
|
||||||
@@ -748,11 +748,11 @@ class autoxml(oo.autosuper, oo.autoprop):
|
|||||||
errs.append(where + _('Mandatory argument not available'))
|
errs.append(where + _('Mandatory argument not available'))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def encode(xml, node, obj, errs):
|
def encode(node, obj, errs):
|
||||||
if node and obj:
|
if node and obj:
|
||||||
try:
|
try:
|
||||||
#FIXME: this doesn't look pretty
|
#FIXME: this doesn't look pretty
|
||||||
obj.encode(xml, node, errs)
|
obj.encode(node, errs)
|
||||||
except Error:
|
except Error:
|
||||||
if req == mandatory:
|
if req == mandatory:
|
||||||
# note: we can receive an error if obj has no content
|
# note: we can receive an error if obj has no content
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ pisi-cli -Dtmp list-repo
|
|||||||
#echo "*** package ops"
|
#echo "*** package ops"
|
||||||
pisi-cli -Dtmp list-available
|
pisi-cli -Dtmp list-available
|
||||||
pisi-cli -Dtmp info python
|
pisi-cli -Dtmp info python
|
||||||
pisi-cli -Dtmp -y install python
|
pisi-cli -Dtmp -By install python
|
||||||
|
|
||||||
echo "*** database contents"
|
echo "*** database contents"
|
||||||
for x in `find tmp -iname '*.bdb'`; do
|
for x in `find tmp -iname '*.bdb'`; do
|
||||||
|
|||||||
Reference in New Issue
Block a user