1 /* 2 * Copyright (c) 2017 Balabit 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 * 18 * As an additional exemption you are allowed to compile & link against the 19 * OpenSSL libraries as published by the OpenSSL project. See the file 20 * COPYING for details. 21 * 22 */ 23 24 #ifndef _COMPAT_PYTHON_H 25 #define _COMPAT_PYTHON_H 26 27 #include <Python.h> 28 #include "syslog-ng.h" 29 30 #if SYSLOG_NG_ENABLE_PYTHONv2 31 #define PYTHON_BUILTIN_MODULE_NAME "__builtin__" 32 #define PYTHON_MODULE_VERSION "python2" 33 34 /* 35 * Macro from python3 Include/datetime.h file 36 */ 37 #define PyDateTime_DELTA_GET_SECONDS(o) (((PyDateTime_Delta*)o)->seconds) 38 #endif 39 40 #if SYSLOG_NG_ENABLE_PYTHONv3 41 #define PYTHON_BUILTIN_MODULE_NAME "builtins" 42 #define PYTHON_MODULE_VERSION "python3" 43 #endif 44 45 void py_setup_python_home(void); 46 void py_init_argv(void); 47 void py_init_threads(void); 48 PyObject *int_as_pyobject(gint num); 49 50 gint pyobject_as_int(PyObject *object); 51 gboolean py_object_is_integer(PyObject *object); 52 53 #endif 54