* fix: take into account that install_pkg_names doesn't have a return

value
This commit is contained in:
Eray Özkural
2005-10-24 11:22:56 +00:00
parent ca08a74d01
commit dc6b8f51c2
+47 -45
View File
@@ -102,57 +102,59 @@ def install_pkg_files(package_URIs):
# if so, then invoke install_pkg_names # if so, then invoke install_pkg_names
extra_packages = [x.package for x in dep_unsatis] extra_packages = [x.package for x in dep_unsatis]
if (extra_packages and install_pkg_names(extra_packages)) or \ if extra_packages:
(not extra_packages): ctx.ui.info(_("""The following minimal list of packages will be installed
in the respective order to satisfy dependencies:
""") + util.strlist(order))
if not ctx.ui.confirm(_('Do you want to continue?')):
raise Error(_('External dependencies not satisfied'))
install_packages(extra_packages)
class PackageDB:
def __init__(self):
self.d = d_t
class PackageDB: def get_package(self, key):
def __init__(self): return d_t[str(key)]
self.d = d_t
def get_package(self, key): packagedb = PackageDB()
return d_t[str(key)]
packagedb = PackageDB() A = d_t.keys()
A = d_t.keys() if len(A)==0:
ctx.ui.info(_('No packages to install.'))
return
if len(A)==0: # try to construct a pisi graph of packages to
ctx.ui.info(_('No packages to install.')) # install / reinstall
return
# try to construct a pisi graph of packages to G_f = pgraph.PGraph(packagedb) # construct G_f
# install / reinstall
G_f = pgraph.PGraph(packagedb) # construct G_f # find the "install closure" graph of G_f by package
# set A using packagedb
# find the "install closure" graph of G_f by package #print A
# set A using packagedb for x in A:
#print A G_f.add_package(x)
for x in A: B = A
G_f.add_package(x) #state = {}
B = A while len(B) > 0:
#state = {} Bp = set()
while len(B) > 0: for x in B:
Bp = set() pkg = packagedb.get_package(x)
for x in B: #print pkg
pkg = packagedb.get_package(x) for dep in pkg.runtimeDeps:
#print pkg #print 'checking ', dep
for dep in pkg.runtimeDeps: if dependency.dict_satisfies_dep(d_t, dep):
#print 'checking ', dep if not dep.package in G_f.vertices():
if dependency.dict_satisfies_dep(d_t, dep): Bp.add(str(dep.package))
if not dep.package in G_f.vertices(): G_f.add_dep(x, dep)
Bp.add(str(dep.package)) B = Bp
G_f.add_dep(x, dep) if ctx.config.get_option('debug'):
B = Bp G_f.write_graphviz(sys.stdout)
if ctx.config.get_option('debug'): order = G_f.topological_sort()
G_f.write_graphviz(sys.stdout) order.reverse()
order = G_f.topological_sort() ctx.ui.info(_('Installation order: ') + util.strlist(order) )
order.reverse() for x in order:
ctx.ui.info(_('Installation order: ') + util.strlist(order) ) atomicoperations.install_single_file(dfn[x])
for x in order:
atomicoperations.install_single_file(dfn[x])
else:
raise Error(_('External dependencies not satisfied'))
return True # everything went OK. return True # everything went OK.
@@ -230,7 +232,7 @@ def install_pkg_names(A):
in the respective order to satisfy dependencies: in the respective order to satisfy dependencies:
""") + util.strlist(order)) """) + util.strlist(order))
if len(order) > len(A_0): if len(order) > len(A_0):
if not ctx.ui.confirm('Do you want to continue?'): if not ctx.ui.confirm(_('Do you want to continue?')):
return False return False
for x in order: for x in order:
atomicoperations.install_single_name(x) atomicoperations.install_single_name(x)