python: Expose less functions to the Python world.
* lang/python/Makefile.am (EXTRA_DIST, COPY_FILES): Add new file. * lang/python/gpgme.i: Include new file and add comments. * lang/python/helpers.c: Include new file. * lang/python/helpers.h: Move functions we do not need to expose... * lang/python/private.h: ... here. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
6a7ee33abd
commit
3d4dc3f021
@ -20,7 +20,7 @@ EXTRA_DIST = \
|
|||||||
README \
|
README \
|
||||||
MANIFEST.in \
|
MANIFEST.in \
|
||||||
gpgme.i \
|
gpgme.i \
|
||||||
helpers.c helpers.h \
|
helpers.c helpers.h private.h \
|
||||||
gpgme-h-clean.py \
|
gpgme-h-clean.py \
|
||||||
examples \
|
examples \
|
||||||
pyme
|
pyme
|
||||||
@ -34,7 +34,7 @@ COPY_FILES = \
|
|||||||
$(srcdir)/gpgme-h-clean.py \
|
$(srcdir)/gpgme-h-clean.py \
|
||||||
$(srcdir)/pyme \
|
$(srcdir)/pyme \
|
||||||
$(srcdir)/examples \
|
$(srcdir)/examples \
|
||||||
$(srcdir)/helpers.c $(srcdir)/helpers.h
|
$(srcdir)/helpers.c $(srcdir)/helpers.h $(srcdir)/private.h
|
||||||
|
|
||||||
# For VPATH builds we need to copy some files because Python's
|
# For VPATH builds we need to copy some files because Python's
|
||||||
# distutils are not VPATH-aware.
|
# distutils are not VPATH-aware.
|
||||||
|
@ -476,8 +476,10 @@ struct _gpgme_sig_notation
|
|||||||
%}
|
%}
|
||||||
FILE *fdopen(int fildes, const char *mode);
|
FILE *fdopen(int fildes, const char *mode);
|
||||||
|
|
||||||
|
/* We include both headers in the generated c code... */
|
||||||
%{
|
%{
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
#include "private.h"
|
||||||
|
|
||||||
/* SWIG support for helpers.c */
|
/* SWIG support for helpers.c */
|
||||||
PyObject *
|
PyObject *
|
||||||
@ -499,4 +501,6 @@ pygpgme_unwrap_gpgme_ctx_t(PyObject *wrapped)
|
|||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
/* ... but only the public definitions here. They will be exposed to
|
||||||
|
the Python world, so let's be careful. */
|
||||||
%include "helpers.h"
|
%include "helpers.h"
|
||||||
|
@ -24,7 +24,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
#include "private.h"
|
||||||
|
|
||||||
static PyObject *GPGMEError = NULL;
|
static PyObject *GPGMEError = NULL;
|
||||||
|
|
||||||
|
@ -26,25 +26,12 @@
|
|||||||
#define write(fd, str, sz) {DWORD written; WriteFile((HANDLE) fd, str, sz, &written, 0);}
|
#define write(fd, str, sz) {DWORD written; WriteFile((HANDLE) fd, str, sz, &written, 0);}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void pygpgme_exception_init(void);
|
|
||||||
gpgme_error_t pygpgme_exception2code(void);
|
|
||||||
|
|
||||||
PyObject *object_to_gpgme_t(PyObject *input, const char *objtype, int argnum);
|
|
||||||
PyObject *object_to_gpgme_data_t(PyObject *input, int argnum,
|
|
||||||
gpgme_data_t *wrapper,
|
|
||||||
PyObject **bytesio, Py_buffer *view);
|
|
||||||
|
|
||||||
PyObject *pygpgme_wrap_fragile_result(PyObject *fragile, const char *classname);
|
|
||||||
|
|
||||||
PyObject *pygpgme_raise_callback_exception(PyObject *self);
|
PyObject *pygpgme_raise_callback_exception(PyObject *self);
|
||||||
|
|
||||||
PyObject *pygpgme_set_passphrase_cb(PyObject *self, PyObject *cb);
|
PyObject *pygpgme_set_passphrase_cb(PyObject *self, PyObject *cb);
|
||||||
PyObject *pygpgme_set_progress_cb(PyObject *self, PyObject *cb);
|
PyObject *pygpgme_set_progress_cb(PyObject *self, PyObject *cb);
|
||||||
PyObject *pygpgme_set_status_cb(PyObject *self, PyObject *cb);
|
PyObject *pygpgme_set_status_cb(PyObject *self, PyObject *cb);
|
||||||
|
|
||||||
gpgme_error_t pyEditCb(void *opaque, gpgme_status_code_t status,
|
|
||||||
const char *args, int fd);
|
|
||||||
|
|
||||||
PyObject *pygpgme_data_new_from_cbs(PyObject *self, PyObject *pycbs,
|
PyObject *pygpgme_data_new_from_cbs(PyObject *self, PyObject *pycbs,
|
||||||
gpgme_data_t *r_data);
|
gpgme_data_t *r_data);
|
||||||
|
|
||||||
|
38
lang/python/private.h
Normal file
38
lang/python/private.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 g10 Code GmbH
|
||||||
|
*
|
||||||
|
* This file is part of GPGME.
|
||||||
|
*
|
||||||
|
* GPGME is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Lesser General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GPGME is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gpgme.h>
|
||||||
|
|
||||||
|
#ifndef _PYME_PRIVATE_H_
|
||||||
|
#define _PYME_PRIVATE_H_
|
||||||
|
|
||||||
|
void pygpgme_exception_init(void);
|
||||||
|
gpgme_error_t pygpgme_exception2code(void);
|
||||||
|
|
||||||
|
PyObject *object_to_gpgme_t(PyObject *input, const char *objtype, int argnum);
|
||||||
|
PyObject *object_to_gpgme_data_t(PyObject *input, int argnum,
|
||||||
|
gpgme_data_t *wrapper,
|
||||||
|
PyObject **bytesio, Py_buffer *view);
|
||||||
|
|
||||||
|
PyObject *pygpgme_wrap_fragile_result(PyObject *fragile, const char *classname);
|
||||||
|
|
||||||
|
gpgme_error_t pyEditCb(void *opaque, gpgme_status_code_t status,
|
||||||
|
const char *args, int fd);
|
||||||
|
|
||||||
|
#endif /* _PYME_PRIVATE_H_ */
|
Loading…
Reference in New Issue
Block a user