* 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
+51 -49
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:
class PackageDB: """) + util.strlist(order))
def __init__(self): if not ctx.ui.confirm(_('Do you want to continue?')):
self.d = d_t raise Error(_('External dependencies not satisfied'))
install_packages(extra_packages)
def get_package(self, key): class PackageDB:
return d_t[str(key)] def __init__(self):
self.d = d_t
packagedb = PackageDB() def get_package(self, key):
return d_t[str(key)]
A = d_t.keys()
if len(A)==0:
ctx.ui.info(_('No packages to install.'))
return
# try to construct a pisi graph of packages to
# install / reinstall
G_f = pgraph.PGraph(packagedb) # construct G_f packagedb = PackageDB()
A = d_t.keys()
if len(A)==0:
ctx.ui.info(_('No packages to install.'))
return
# find the "install closure" graph of G_f by package # try to construct a pisi graph of packages to
# set A using packagedb # install / reinstall
#print A
for x in A: G_f = pgraph.PGraph(packagedb) # construct G_f
G_f.add_package(x)
B = A # find the "install closure" graph of G_f by package
#state = {} # set A using packagedb
while len(B) > 0: #print A
Bp = set() for x in A:
for x in B: G_f.add_package(x)
pkg = packagedb.get_package(x) B = A
#print pkg #state = {}
for dep in pkg.runtimeDeps: while len(B) > 0:
#print 'checking ', dep Bp = set()
if dependency.dict_satisfies_dep(d_t, dep): for x in B:
if not dep.package in G_f.vertices(): pkg = packagedb.get_package(x)
Bp.add(str(dep.package)) #print pkg
G_f.add_dep(x, dep) for dep in pkg.runtimeDeps:
B = Bp #print 'checking ', dep
if ctx.config.get_option('debug'): if dependency.dict_satisfies_dep(d_t, dep):
G_f.write_graphviz(sys.stdout) if not dep.package in G_f.vertices():
order = G_f.topological_sort() Bp.add(str(dep.package))
order.reverse() G_f.add_dep(x, dep)
ctx.ui.info(_('Installation order: ') + util.strlist(order) ) B = Bp
for x in order: if ctx.config.get_option('debug'):
atomicoperations.install_single_file(dfn[x]) G_f.write_graphviz(sys.stdout)
else: order = G_f.topological_sort()
raise Error(_('External dependencies not satisfied')) order.reverse()
ctx.ui.info(_('Installation order: ') + util.strlist(order) )
for x in order:
atomicoperations.install_single_file(dfn[x])
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)