summaryrefslogtreecommitdiff
path: root/tests/pkgproblemresolver.py
diff options
context:
space:
mode:
authorBen Finney <ben@benfinney.id.au>2008-05-16 16:50:38 +1000
committerBen Finney <ben@benfinney.id.au>2008-05-16 16:50:38 +1000
commitad7bc46acd80451de21ce58450edb0f4367a5c79 (patch)
tree12775f7901544a709f8d63079f1cd57fef00f5a8 /tests/pkgproblemresolver.py
parenta953d82143f0ec979e18f17e8d9bbacbac954868 (diff)
downloadpython-apt-ad7bc46acd80451de21ce58450edb0f4367a5c79.tar.gz
Fix code indentation to 4 spaces, to conform with PEP 8.
Diffstat (limited to 'tests/pkgproblemresolver.py')
-rw-r--r--tests/pkgproblemresolver.py110
1 files changed, 55 insertions, 55 deletions
diff --git a/tests/pkgproblemresolver.py b/tests/pkgproblemresolver.py
index 546e2f16..82186d40 100644
--- a/tests/pkgproblemresolver.py
+++ b/tests/pkgproblemresolver.py
@@ -8,63 +8,63 @@ import sys
def main():
- apt_pkg.init()
- cache = apt_pkg.GetCache()
- depcache = apt_pkg.GetDepCache(cache)
- depcache.Init()
- i=0
- all=cache.PackageCount
- print "Running DepCache test on all packages"
- print "(trying to install each and then mark it keep again):"
- # first, get all pkgs
- for pkg in cache.Packages:
- i += 1
- x = pkg.Name
- # then get each version
- ver =depcache.GetCandidateVer(pkg)
- if ver != None:
- depcache.MarkInstall(pkg)
- if depcache.BrokenCount > 0:
- fixer = apt_pkg.GetPkgProblemResolver(depcache)
- fixer.Clear(pkg)
- fixer.Protect(pkg)
- # we first try to resolve the problem
- # with the package that should be installed
- # protected
- try:
- fixer.Resolve(True)
- except SystemError:
- # the pkg seems to be broken, the
- # returns a exception
- fixer.Clear(pkg)
- fixer.Resolve(True)
- if not depcache.MarkedInstall(pkg):
- print "broken in archive: %s " % pkg.Name
- fixer = None
- if depcache.InstCount == 0:
- if depcache.IsUpgradable(pkg):
- print "Error marking %s for install" % x
- for p in cache.Packages:
- if depcache.MarkedInstall(p) or depcache.MarkedUpgrade(p):
- depcache.MarkKeep(p)
- if depcache.InstCount != 0:
- print "Error undoing the selection for %s" % x
- print "\r%i/%i=%.3f%% " % (i,all,(float(i)/float(all)*100)),
+ apt_pkg.init()
+ cache = apt_pkg.GetCache()
+ depcache = apt_pkg.GetDepCache(cache)
+ depcache.Init()
+ i=0
+ all=cache.PackageCount
+ print "Running DepCache test on all packages"
+ print "(trying to install each and then mark it keep again):"
+ # first, get all pkgs
+ for pkg in cache.Packages:
+ i += 1
+ x = pkg.Name
+ # then get each version
+ ver =depcache.GetCandidateVer(pkg)
+ if ver != None:
+ depcache.MarkInstall(pkg)
+ if depcache.BrokenCount > 0:
+ fixer = apt_pkg.GetPkgProblemResolver(depcache)
+ fixer.Clear(pkg)
+ fixer.Protect(pkg)
+ # we first try to resolve the problem
+ # with the package that should be installed
+ # protected
+ try:
+ fixer.Resolve(True)
+ except SystemError:
+ # the pkg seems to be broken, the
+ # returns a exception
+ fixer.Clear(pkg)
+ fixer.Resolve(True)
+ if not depcache.MarkedInstall(pkg):
+ print "broken in archive: %s " % pkg.Name
+ fixer = None
+ if depcache.InstCount == 0:
+ if depcache.IsUpgradable(pkg):
+ print "Error marking %s for install" % x
+ for p in cache.Packages:
+ if depcache.MarkedInstall(p) or depcache.MarkedUpgrade(p):
+ depcache.MarkKeep(p)
+ if depcache.InstCount != 0:
+ print "Error undoing the selection for %s" % x
+ print "\r%i/%i=%.3f%% " % (i,all,(float(i)/float(all)*100)),
- print
- print "Trying Upgrade:"
- depcache.Upgrade()
- print "To install: %s " % depcache.InstCount
- print "To remove: %s " % depcache.DelCount
- print "Kept back: %s " % depcache.KeepCount
+ print
+ print "Trying Upgrade:"
+ depcache.Upgrade()
+ print "To install: %s " % depcache.InstCount
+ print "To remove: %s " % depcache.DelCount
+ print "Kept back: %s " % depcache.KeepCount
- print "Trying DistUpgrade:"
- depcache.Upgrade(True)
- print "To install: %s " % depcache.InstCount
- print "To remove: %s " % depcache.DelCount
- print "Kept back: %s " % depcache.KeepCount
+ print "Trying DistUpgrade:"
+ depcache.Upgrade(True)
+ print "To install: %s " % depcache.InstCount
+ print "To remove: %s " % depcache.DelCount
+ print "Kept back: %s " % depcache.KeepCount
if __name__ == "__main__":
- main()
- sys.exit(0)
+ main()
+ sys.exit(0)