diff options
| -rw-r--r-- | apt/cache.py | 4 | ||||
| -rw-r--r-- | debian/changelog | 2 | ||||
| -rw-r--r-- | python/cache.cc | 5 |
3 files changed, 7 insertions, 4 deletions
diff --git a/apt/cache.py b/apt/cache.py index bc1d1160..756f9ba9 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -269,7 +269,7 @@ class Cache(object): providers.append(pkg) return providers - def update(self, fetchProgress=None): + def update(self, fetchProgress=None, pulseInterval=0): " run the equivalent of apt-get update " lockfile = apt_pkg.Config.FindDir("Dir::State::Lists") + "lock" lock = apt_pkg.GetLock(lockfile) @@ -279,7 +279,7 @@ class Cache(object): try: if fetchProgress is None: fetchProgress = apt.progress.FetchProgress() - return self._cache.Update(fetchProgress, self._list) + return self._cache.Update(fetchProgress, self._list, pulseInterval) finally: os.close(lock) diff --git a/debian/changelog b/debian/changelog index ba159ab7..b7208dd3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ python-apt (0.7.13.0) UNRELEASED; urgency=low [ Michael Vogt ] * apt/package.py: - add "recommends" property + * apt/cache.py, python/cache.cc: + - add optional pulseInterval option to "update()" [ Sebastian Heinlein ] * apt/cache.py: diff --git a/python/cache.cc b/python/cache.cc index c7e5e76e..f0da8511 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -81,13 +81,14 @@ static PyObject *PkgCacheUpdate(PyObject *Self,PyObject *Args) PyObject *pyFetchProgressInst = 0; PyObject *pySourcesList = 0; - if (PyArg_ParseTuple(Args, "OO", &pyFetchProgressInst,&pySourcesList) == 0) + int pulseInterval = 5000; + if (PyArg_ParseTuple(Args, "OO|i", &pyFetchProgressInst,&pySourcesList, &pulseInterval) == 0) return 0; PyFetchProgress progress; progress.setCallbackInst(pyFetchProgressInst); pkgSourceList *source = GetCpp<pkgSourceList*>(pySourcesList); - bool res = ListUpdate(progress, *source); + bool res = ListUpdate(progress, *source, pulseInterval); PyObject *PyRes = Py_BuildValue("b", res); return HandleErrors(PyRes); |
