summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt/__init__.py2
-rw-r--r--apt/cache.py6
-rw-r--r--apt/progress.py4
-rw-r--r--python/progress.cc17
4 files changed, 20 insertions, 9 deletions
diff --git a/apt/__init__.py b/apt/__init__.py
index eb4e3268..2a478b34 100644
--- a/apt/__init__.py
+++ b/apt/__init__.py
@@ -7,7 +7,7 @@ import os
from apt.package import Package
from apt.cache import Cache
from apt.progress import OpProgress, FetchProgress, InstallProgress, CdromProgress
-from apt_pkg import SizeToStr, VersionCompare
+from apt_pkg import SizeToStr, TimeToStr, VersionCompare
# init the package system
apt_pkg.init()
diff --git a/apt/cache.py b/apt/cache.py
index 50a896e6..83f0bd3d 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -103,6 +103,12 @@ class Cache(object):
self._depcache.Upgrade(distUpgrade)
self.cachePostChange()
+ def update(self, fetchProgress=None, opProgress=None):
+ if(opProgress != None):
+ self._cache.Update(fetchProgress, opProgress);
+ else:
+ self._cache.Update(fetchProgress);
+
def commit(self, fprogress, iprogress):
""" Apply the marked changes to the cache """
self._depcache.Commit(fprogress, iprogress)
diff --git a/apt/progress.py b/apt/progress.py
index 4e5ffe4d..70696b6b 100644
--- a/apt/progress.py
+++ b/apt/progress.py
@@ -61,11 +61,13 @@ class FetchProgress:
pass
def pulse(self):
- pass
+ return True
def mediaChange(self, medium, drive):
pass
+
+
class InstallProgress:
""" Report the install progress
Subclass this class to implement install progress reporting
diff --git a/python/progress.cc b/python/progress.cc
index 3439bfd8..33b4ed97 100644
--- a/python/progress.cc
+++ b/python/progress.cc
@@ -139,8 +139,6 @@ void PyFetchProgress::Stop()
RunSimpleCallback("stop");
}
-// FIXME: it should just set the attribute for
-// CurrentCPS, Current...
bool PyFetchProgress::Pulse(pkgAcquire * Owner)
{
pkgAcquireStatus::Pulse(Owner);
@@ -161,12 +159,17 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner)
PyObject_SetAttrString(callbackInst, "totalItems", o);
o = Py_BuildValue("f", TotalBytes);
PyObject_SetAttrString(callbackInst, "totalBytes", o);
-
- RunSimpleCallback("pulse");
-
- // this can be canceld by returning false
- return true;
+ PyObject *arglist = Py_BuildValue("()");
+ PyObject *result;
+ RunSimpleCallback("pulse", arglist, &result);
+
+ bool res = true;
+ if(!PyArg_Parse(result, "b", &res))
+ std::cerr << "result could not be parsed" << std::endl;
+
+ // fetching can be canceld by returning false
+ return res;
}