diff options
| author | Michael Vogt <mvo@ubuntu.com> | 2014-11-06 21:59:18 +0100 |
|---|---|---|
| committer | Michael Vogt <mvo@ubuntu.com> | 2014-11-06 21:59:18 +0100 |
| commit | d92026e96db4a4d03cec9f135b5407804892c55f (patch) | |
| tree | da845b12789b2e0e51f23723020ecf02080a7bb4 /python | |
| parent | b066cf677e2cbd480bd2e74b48147bfd226ae463 (diff) | |
| download | python-apt-d92026e96db4a4d03cec9f135b5407804892c55f.tar.gz | |
Add binding for apt_pkg.maybe_open_clear_signed_file()
Diffstat (limited to 'python')
| -rw-r--r-- | python/apt_pkgmodule.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index e00ce0ca..0d84f468 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -27,6 +27,7 @@ #include <apt-pkg/orderlist.h> #include <apt-pkg/aptconfiguration.h> #include <apt-pkg/fileutl.h> +#include <apt-pkg/gpgv.h> #include <sys/stat.h> #include <libintl.h> @@ -472,6 +473,25 @@ static PyObject *InitSystem(PyObject *Self,PyObject *Args) return HandleErrors(Py_None); } /*}}}*/ +// gpgv.cc:OpenMaybeClearSignedFile /*{{{*/ +// --------------------------------------------------------------------- +static char *doc_OpenMaybeClearSignedFile = +"open_maybe_clear_signed_file(file: str) -> int\n\n" +"Open a file and ignore a PGP clear signature.\n" +"Return a open file descriptor or a error."; +static PyObject *PyOpenMaybeClearSignedFile(PyObject *Self,PyObject *Args) +{ + PyApt_Filename file; + char errors = false; + if (PyArg_ParseTuple(Args,"O&",PyApt_Filename::Converter, &file,&errors) == 0) + return 0; + + FileFd Fd; + if (OpenMaybeClearSignedFile(file, Fd) == false) + return HandleErrors(MkPyNumber(-1)); + + return HandleErrors(MkPyNumber(dup(Fd.Fd()))); +} // fileutils.cc: GetLock /*{{{*/ // --------------------------------------------------------------------- @@ -546,6 +566,9 @@ static PyMethodDef methods[] = // Tag File {"rewrite_section",RewriteSection,METH_VARARGS,doc_RewriteSection}, + {"open_maybe_clear_signed_file",PyOpenMaybeClearSignedFile,METH_VARARGS, + doc_OpenMaybeClearSignedFile}, + // Locking {"get_lock",GetLock,METH_VARARGS,doc_GetLock}, {"pkgsystem_lock",PkgSystemLock,METH_VARARGS,doc_PkgSystemLock}, |
