Commit 09449a3a authored by Julian Andres Klode's avatar Julian Andres Klode

AcquireItem: Deprecate mode and introduce active_subprocess

This is simply following the APT 1.1 change.
parent 32dd84d4
......@@ -188,8 +188,8 @@ class AcquireProgress(base.AcquireProgress, TextProgress):
worker.current_item.shortdesc)
else:
val += ' [%s' % worker.current_item.description
if worker.current_item.owner.mode:
val += ' %s' % worker.current_item.owner.mode
if worker.current_item.owner.active_subprocess:
val += ' %s' % worker.current_item.owner.active_subprocess
val += ' %sB' % apt_pkg.size_to_str(worker.current_size)
......
......@@ -1659,8 +1659,15 @@ installation.
.. attribute:: mode
A localized string indicating the current mode e.g. ``"Fetching"``,
it may be used as part of printing progress information.
Old name for active_subprocess
.. deprecated:: 1.0
.. attribute:: active_subprocess
The name of the active subprocess (for instance, 'gzip', 'rred' or 'gpgv').
.. versionadded:: 1.0
**Status**:
......
......@@ -29,6 +29,8 @@ The following features are deprecated, starting with this release:
* The method :meth:`apt.cache.Cache.connect` has been deprecated. It is
replaced by :meth:`apt.cache.Cache.connect2` which is more flexible and
less prone to reference cycles.
* The attribute :attr:`apt_pkg.AcquireItem.mode` has been replaced by
:attr:`apt_pkg.AcquireItem.active_subprocess`
Removed
-------
......
......@@ -74,10 +74,22 @@ static PyObject *acquireitem_get_id(PyObject *self, void *closure)
return item ? MkPyNumber(item->ID) : 0;
}
static PyObject *acquireitem_get_mode(PyObject *self, void *closure)
static PyObject *acquireitem_get_active_subprocess(PyObject *self, void *closure)
{
pkgAcquire::Item *item = acquireitem_tocpp(self);
#if APT_PKG_MAJOR > 5
return item ? Py_BuildValue("s", item->ActiveSubProcess.c_str()) : 0;
#else
return item ? Py_BuildValue("s", item->Mode) : 0;
#endif
}
static PyObject *acquireitem_get_mode(PyObject *self, void *closure)
{
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"AcquireItem.mode is deprecated, use AcquireItem.active_subprocess instead.", 1) == -1)
return NULL;
return acquireitem_get_active_subprocess(self, closure);
}
static PyObject *acquireitem_get_is_trusted(PyObject *self, void *closure)
......@@ -139,8 +151,9 @@ static PyGetSetDef acquireitem_getset[] = {
{"id",acquireitem_get_id,acquireitem_set_id,
"The ID of the item. An integer which can be set by progress classes."},
{"mode",acquireitem_get_mode,NULL,
"A localized string such as 'Fetching' which indicates the current\n"
"mode."},
"Old name for active_subprocess"},
{"active_subprocess",acquireitem_get_active_subprocess,NULL,
"The name of the active subprocess (for instance, 'gzip', 'rred' or 'gpgv')."},
{"is_trusted",acquireitem_get_is_trusted,NULL,
"Whether the item is trusted or not. Only True for packages\n"
"which come from a repository signed with one of the keys in\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment