summaryrefslogtreecommitdiff
path: root/DistUpgrade/DistUpgradeViewNonInteractive.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-02-02 11:41:31 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2006-02-02 11:41:31 +0000
commit41006b0fd874a862195b918fad17a7ae04f4fe57 (patch)
treed6de2740472e9ee74d0439435d893068c1419d3c /DistUpgrade/DistUpgradeViewNonInteractive.py
parent8f0dd0952652c01cdfe4a69a9275a479db0c8ac2 (diff)
downloadpython-apt-41006b0fd874a862195b918fad17a7ae04f4fe57.tar.gz
* added first non-interactive version
Diffstat (limited to 'DistUpgrade/DistUpgradeViewNonInteractive.py')
-rw-r--r--DistUpgrade/DistUpgradeViewNonInteractive.py72
1 files changed, 72 insertions, 0 deletions
diff --git a/DistUpgrade/DistUpgradeViewNonInteractive.py b/DistUpgrade/DistUpgradeViewNonInteractive.py
new file mode 100644
index 00000000..f77d3d43
--- /dev/null
+++ b/DistUpgrade/DistUpgradeViewNonInteractive.py
@@ -0,0 +1,72 @@
+# DistUpgradeView.py
+#
+# Copyright (c) 2004,2005 Canonical
+#
+# Author: Michael Vogt <michael.vogt@ubuntu.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+
+class NonInteractiveDistUpgradeView(object):
+ " non-interactive version of the upgrade view "
+ def __init__(self):
+ pass
+ def getOpCacheProgress(self):
+ " return a OpProgress() subclass for the given graphic"
+ return apt.progress.OpProgress()
+ def getFetchProgress(self):
+ " return a fetch progress object "
+ return apt.progress.FetchProgress()
+ def getInstallProgress(self):
+ " return a install progress object "
+ return apt.progress.InstallProgress()
+ def updateStatus(self, msg):
+ """ update the current status of the distUpgrade based
+ on the current view
+ """
+ pass
+ def setStep(self, step):
+ """ we have 5 steps current for a upgrade:
+ 1. Analyzing the system
+ 2. Updating repository information
+ 3. Performing the upgrade
+ 4. Post upgrade stuff
+ 5. Complete
+ """
+ pass
+ def confirmChanges(self, summary, changes, downloadSize):
+ """ display the list of changed packages (apt.Package) and
+ return if the user confirms them
+ """
+ self.toInstall = []
+ self.toUpgrade = []
+ self.toRemove = []
+ for pkg in changes:
+ if pkg.markedInstall: self.toInstall.append(pkg.name)
+ elif pkg.markedUpgrade: self.toUpgrade.append(pkg.name)
+ elif pkg.markedDelete: self.toRemove.append(pkg.name)
+ # no downgrades, re-installs
+ assert(len(self.toInstall)+len(self.toUpgrade)+len(self.toRemove) == len(changes))
+ return True
+ def askYesNoQuestion(self, summary, msg):
+ " ask a Yes/No question and return True on 'Yes' "
+ return True
+ def confirmRestart(self):
+ " generic ask about the restart, can be overriden "
+ return False
+ def error(self, summary, msg, extended_msg=None):
+ " display a error "
+ logging.error("%s %s (%s)" % (summary, msg, extended_msg)
+