diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2007-07-30 22:46:27 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2007-07-30 22:46:27 +0200 |
| commit | e124705b95abb6ea3c4c6f96ed5559dac8a2c697 (patch) | |
| tree | 26f9eed0e173d47bd63456aecfee76506ce537d5 /python/apt_instmodule.cc | |
| parent | a13e90fd1c1f2809d60f61c1d16a3cf4ebba18c9 (diff) | |
| download | python-apt-e124705b95abb6ea3c4c6f96ed5559dac8a2c697.tar.gz | |
* apt/debfile.py:
- added wrapper around apt_inst.debExtract()
- support dictionary like access
* python/apt_instmodule.cc:
- added arCheckMember()
Diffstat (limited to 'python/apt_instmodule.cc')
| -rw-r--r-- | python/apt_instmodule.cc | 31 |
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}, |
