diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-04-11 14:30:01 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-04-11 14:30:01 +0000 |
| commit | fa60f6847ebc68383799b0a8f4fb36b16726d0f7 (patch) | |
| tree | 95d38444c287c406b24184b73d1484204b315685 | |
| parent | a8074615c2bac880bf4fd7d5b15e621b88a20052 (diff) | |
| download | python-apt-fa60f6847ebc68383799b0a8f4fb36b16726d0f7.tar.gz | |
* added Cdrom.Ident(), improved the examples
| -rw-r--r-- | doc/examples/cdrom.py | 7 | ||||
| -rw-r--r-- | python/cdrom.cc | 15 |
2 files changed, 17 insertions, 5 deletions
diff --git a/doc/examples/cdrom.py b/doc/examples/cdrom.py index e1873093..bf044d7c 100644 --- a/doc/examples/cdrom.py +++ b/doc/examples/cdrom.py @@ -15,10 +15,15 @@ cdrom = apt_pkg.GetCdrom() print cdrom progress = CdromProgress() -apt_pkg.Config.Set("APT::CDROM::Rename", "True") +(res,ident) = cdrom.Ident(progress) +print "ident result is: %s (%s) " % (res, ident) + +apt_pkg.Config.Set("APT::CDROM::Rename", "True") cdrom.Add(progress) + + print "Exiting" sys.exit(0) diff --git a/python/cdrom.cc b/python/cdrom.cc index 764110ce..13889b31 100644 --- a/python/cdrom.cc +++ b/python/cdrom.cc @@ -40,13 +40,20 @@ static PyObject *PkgCdromIdent(PyObject *Self,PyObject *Args) { PkgCdromStruct &Struct = GetCpp<PkgCdromStruct>(Self); - if (PyArg_ParseTuple(Args,"") == 0) + PyObject *pyCdromProgressInst = 0; + if (PyArg_ParseTuple(Args, "O", &pyCdromProgressInst) == 0) { return 0; + } - //pkgFixBroken(*Struct.depcache); + PyCdromProgress progress; + progress.setCallbackInst(pyCdromProgressInst); - Py_INCREF(Py_None); - return HandleErrors(Py_None); + string ident; + bool res = Struct.cdrom.Ident(ident, &progress); + + PyObject *result = Py_BuildValue("(bs)", res, ident.c_str()); + + return HandleErrors(result); } |
