summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DistUpgrade/DistUpgradeCache.py7
-rw-r--r--DistUpgrade/DistUpgradeControler.py14
-rw-r--r--UpdateManager/UpdateManager.py2
3 files changed, 16 insertions, 7 deletions
diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py
index 99f3b585..8427bb3d 100644
--- a/DistUpgrade/DistUpgradeCache.py
+++ b/DistUpgrade/DistUpgradeCache.py
@@ -68,7 +68,7 @@ class MyCache(apt.Cache):
self.to_remove.append(pkg.name)
def clear(self):
- self.depcache.Init()
+ self._depcache.Init()
def restore_snapshot(self):
""" restore a snapshot """
@@ -318,3 +318,8 @@ class MyCache(apt.Cache):
if foreign:
foreign_pkgs.add(pkg.name)
return foreign_pkgs
+
+if __name__ == "__main__":
+ import DistUpgradeConfigParser
+ c = MyCache(DistUpgradeConfigParser.DistUpgradeConfig("."))
+ c.clear()
diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py
index bcb54553..5217a990 100644
--- a/DistUpgrade/DistUpgradeControler.py
+++ b/DistUpgrade/DistUpgradeControler.py
@@ -107,11 +107,15 @@ class DistUpgradeControler(object):
self._view.updateStatus(_("Reading cache"))
self.cache = None
- if self.options.withNetwork == None:
+ if not self.options or self.options.withNetwork == None:
self.useNetwork = True
else:
self.useNetwork = self.options.withNetwork
- self.aptcdrom = AptCdrom(distUpgradeView, options.cdromPath)
+ if options:
+ cdrompath = options.cdromPath
+ else:
+ cdrompath = None
+ self.aptcdrom = AptCdrom(distUpgradeView, cdrompath)
# the configuration
self.config = DistUpgradeConfig(datadir)
@@ -143,7 +147,7 @@ class DistUpgradeControler(object):
return False
# FIXME: we may try to find out a bit more about the network
# connection here and ask more inteligent questions
- if self.aptcdrom and self.options.withNetwork == None:
+ if self.aptcdrom and self.options and self.options.withNetwork == None:
res = self._view.askYesNoQuestion(_("Fetch data from the network for the upgrade?"),
_("The upgrade can use the network to check "
"the latest updates and to fetch packages that are not on the "
@@ -422,7 +426,7 @@ class DistUpgradeControler(object):
return res
def doDistUpgrade(self):
- if self.options.haveBackports:
+ if self.options and self.options.haveBackports:
backportsdir = os.getcwd()+"/backports"
apt_pkg.Config.Set("Dir::Bin::dpkg",backportsdir+"/usr/bin/dpkg");
currentRetry = 0
@@ -647,7 +651,7 @@ class DistUpgradeControler(object):
if not self.prepare():
self.abort(1)
- if self.options.haveBackports == False:
+ if selfoptions and self.options.haveBackports == False:
# get backported packages (if needed)
self.getRequiredBackports()
diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py
index 0d70b56c..a609ab5e 100644
--- a/UpdateManager/UpdateManager.py
+++ b/UpdateManager/UpdateManager.py
@@ -33,7 +33,7 @@ try:
except:
import fakegconf as gconf
import gobject
-from warnings import warn
+import warnings
warnings.filterwarnings("ignore", "apt API not stable yet", FutureWarning)
import apt
import apt_pkg