summaryrefslogtreecommitdiff
path: root/apt
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-10-21 09:13:58 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-10-21 09:13:58 +0200
commit8ca5779cfe930f8a423969f7266949ab2826cede (patch)
tree44918730b1f9f5a567ac89f15ab661ae7be1e1a9 /apt
parent50756e0efb5081d3379fa874ca41ab57bdf2798d (diff)
parent52097d7edaa97379a4a604be4feb24e5e9c3bd73 (diff)
downloadpython-apt-8ca5779cfe930f8a423969f7266949ab2826cede.tar.gz
merged from the debian-sid branch
Diffstat (limited to 'apt')
-rw-r--r--apt/cache.py7
-rw-r--r--apt/debfile.py4
-rw-r--r--apt/utils.py6
3 files changed, 10 insertions, 7 deletions
diff --git a/apt/cache.py b/apt/cache.py
index be137b76..bab5c277 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -46,8 +46,7 @@ class LockFailedException(IOError):
class Cache(object):
"""Dictionary-like package cache.
- This class has all the packages that are available in it's
- dictionary.
+ The dictionary of this class contains all available packages.
Keyword arguments:
progress -- a OpProgress object
@@ -507,7 +506,7 @@ class Cache(object):
self._callbacks[name].append(callback)
def actiongroup(self):
- """Return an ActionGroup() object for the current cache.
+ """Return an action group object for the current cache.
Action groups can be used to speedup actions. The action group is
active as soon as it is created, and disabled when the object is
@@ -520,7 +519,7 @@ class Cache(object):
for package in my_selected_packages:
package.mark_install()
- This way, the ActionGroup is automatically released as soon as the
+ This way, the action group is automatically released as soon as the
with statement block is left. It also has the benefit of making it
clear which parts of the code run with a action group and which
don't.
diff --git a/apt/debfile.py b/apt/debfile.py
index d0f41def..104b0814 100644
--- a/apt/debfile.py
+++ b/apt/debfile.py
@@ -472,7 +472,7 @@ class DebPackage(object):
def missing_deps(self):
"""Return missing dependencies."""
self._dbg(1, "Installing: %s" % self._need_pkgs)
- if self._need_pkgs is None:
+ if not self._need_pkgs:
self.check()
return self._need_pkgs
@@ -485,6 +485,8 @@ class DebPackage(object):
install = []
remove = []
unauthenticated = []
+ if not self._cache:
+ self.check()
for pkg in self._cache:
if pkg.marked_install or pkg.marked_upgrade:
install.append(pkg.name)
diff --git a/apt/utils.py b/apt/utils.py
index 4b3da39f..49e8bed5 100644
--- a/apt/utils.py
+++ b/apt/utils.py
@@ -28,11 +28,13 @@ def get_maintenance_end_date(release_date, m_months):
ends. Needs the data of the release and the number of months that
its is supported as input
"""
- years = m_months / 12
+ # calc end date
+ years = m_months // 12
months = m_months % 12
support_end_year = (release_date.year + years +
- (release_date.month + months)/12)
+ (release_date.month + months)//12)
support_end_month = (release_date.month + months) % 12
+ # special case: this happens when e.g. doing 2010-06 + 18 months
if support_end_month == 0:
support_end_month = 12
support_end_year -= 1