summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2007-07-31 13:43:09 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2007-07-31 13:43:09 +0200
commita7da352b92726adf18f121de2711976f356ded29 (patch)
treee1eae8b17d2fcecb704805a46753867d58986538 /python
parent254c868e6e5e536eecdafc27c546b036397c2dc5 (diff)
parente124705b95abb6ea3c4c6f96ed5559dac8a2c697 (diff)
downloadpython-apt-a7da352b92726adf18f121de2711976f356ded29.tar.gz
* apt/debfile.py:
- added wrapper around apt_inst.debExtract() - support dictionary like access * python/apt_instmodule.cc: - added arCheckMember() * build with latest python-distutils-extra (thanks to doko for notifiying about the problem) * apt/package.py: - added Record class that can be accessed like a dictionary and return it in candidateRecord and installedRecord (thanks to Alexander Sack for discussing this with me) * doc/examples/records.py: - added example how to use the new Records class * apt/cache.py: - throw FetchCancelleException, FetchFailedException, LockFailedException exceptions when something goes wrong - generalized some code, bringing it into the Distribution class, and wrote some missing methods for the DebianDistribution one (thanks to Gustavo Noronha Silva) - updated for python-distutils-extra (>= 1.9.0) - fix i18n files - increase str buffer in PackageIndexFileRepr * python/package.py: * python/cache.py:
Diffstat (limited to 'python')
-rw-r--r--python/apt_instmodule.cc31
1 files changed, 30 insertions, 1 deletions
diff --git a/python/apt_instmodule.cc b/python/apt_instmodule.cc
index d672a40a..43d5e7f7 100644
--- a/python/apt_instmodule.cc
+++ b/python/apt_instmodule.cc
@@ -102,15 +102,44 @@ static PyObject *debExtractArchive(PyObject *Self,PyObject *Args)
return HandleErrors(Py_BuildValue("b",res));
}
/*}}}*/
+// arFindMember - Find member in AR archive /*{{{*/
+// ---------------------------------------------------------------------
+static char *doc_arCheckMember =
+"arCheckMember(File, membername) -> Bool\n";
+static PyObject *arCheckMember(PyObject *Self,PyObject *Args)
+{
+ char *Member = NULL;
+ bool res = false;
+ PyObject *File;
+ if (PyArg_ParseTuple(Args,"O!s",&PyFile_Type,&File,&Member) == 0)
+ return 0;
+
+ // Open the file and associate the .deb
+ FileFd Fd(fileno(PyFile_AsFile(File)),false);
+ ARArchive AR(Fd);
+ if (_error->PendingError() == true)
+ return HandleErrors(Py_BuildValue("b",res));
+
+ if(AR.FindMember(Member) != 0)
+ res = true;
+
+ return HandleErrors(Py_BuildValue("b",res));
+}
+ /*}}}*/
// initapt_inst - Core Module Initialization /*{{{*/
// ---------------------------------------------------------------------
/* */
static PyMethodDef methods[] =
{
- // Stuff
+ // access to ar files
+ {"arCheckMember", arCheckMember, METH_VARARGS, doc_arCheckMember},
+
+ // access to deb files
{"debExtractControl",debExtractControl,METH_VARARGS,doc_debExtractControl},
{"debExtractArchive",debExtractArchive,METH_VARARGS,doc_debExtractArchive},
+
+ // access to tar streams
{"tarExtract",tarExtract,METH_VARARGS,doc_tarExtract},
{"debExtract",debExtract,METH_VARARGS,doc_debExtract},