[M-git] Mahogany sources repository. branch master updated. v0.67-846-g2ed4ee77
vadz via Mahogany-cvsupdates <[email protected]> Sun, 31 Mar 2024 22:54:10 +0000
| Newsgroups | gmane.mail.mahogany.cvs |
|---|---|
| Message-ID | <[email protected]> |
--===============6949208375537460313==
Content-Type: text/plain
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Mahogany sources repository.".
The branch, master has been updated
via 2ed4ee7769d64c3f21f738cb0ba1bf57aed032d3 (commit)
via 1332f9adccc91bd66699992d85bb2adb8f9cc235 (commit)
via 7dc61e5df661fd3fd90395b7922ccc9ba7d24088 (commit)
via dce8a08344eeee58b79365683a7ae4f01fe43898 (commit)
via eda0a65555519761ac608c6d509ee13201ebefa4 (commit)
from 2cea6d1be3661a1029ace9cd27de7a47cc07e9cd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 2ed4ee7769d64c3f21f738cb0ba1bf57aed032d3
Author: Vadim Zeitlin <[email protected]>
Date: Sat Mar 30 17:46:10 2024 +0100
Drop "dynamic" Python support
Always link Python statically, this shouldn't be really a problem any
more and maintaining support for dynamic loading was so much work that
it was abandoned and bitrotted away anyhow.
diff --git a/acinclude.m4 b/acinclude.m4
index bd5c12db..ffc817ab 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -133,43 +133,6 @@ AC_DEFUN([M_CHECK_MYHEADER],
]
)
-dnl M_CHECK_MYHEADER_VER(HEADER-FILE, VERSION, LIBPATHLIST, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-AC_DEFUN([M_CHECK_MYHEADER_VER],
- [ m_safe=`echo "$1_$2" | sed 'y%./+-%__p_%'`
- AC_MSG_CHECKING([for $1 ($2)])
- AC_CACHE_VAL(m_cv_header_$m_safe,
- [ m_save_CPPFLAGS="$CPPFLAGS"
- for j in "." $3 ; do
- CPPFLAGS="-I$j $CPPFLAGS"
- AC_TRY_CPP(dnl
- [#include <$1>],
- [
- if test "$j" = "."; then
- j="/usr/include"
- fi
- eval "m_cv_header_$m_safe=$j"
- CPPFLAGS="$m_save_CPPFLAGS"
- break
- ],
- [ eval "m_cv_header_$m_safe=no" ]
- )
- CPPFLAGS="$m_save_CPPFLAGS"
- done
- ]
- )
- if eval "test \"`echo '$m_cv_header_'$m_safe`\" != no"; then
- dnl FIXME surely there must be a simpler way? (VZ)
- dir=`eval echo $\`eval echo m_cv_header_$m_safe\``
- AC_MSG_RESULT(yes (in $dir))
- eval "CPPFLAGS=\"-I$dir $CPPFLAGS\""
- ifelse([$4], , :, [$4])
- else
- AC_MSG_RESULT(no)
- ifelse([$5], , , [$5])dnl
- fi
- ]
-)
-
dnl M_ADD_CXXFLAGS_IF_SUPPORTED(OPTION)
dnl
dnl Check if the C++ compiler supports the given option and adds it to CXXFLAGS
diff --git a/configure.ac b/configure.ac
index 3ac064d8..3a8378aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,29 +113,16 @@ M_OVERRIDES(nls,i18n support,USE_I18N,1,
--disable-nls no internationalization support)
M_OVERRIDES(python,Python scripting,USE_PYTHON,1,
---with-python=xxx one of none/static/dynamic)
+--with-python use Python scripting)
M_OVERRIDES(dspam,DSPAM spam filter,USE_DSPAM,1,
--with-dspam use DSPAM for spam filtering)
-dnl choose how to use Python: normally, dynamic loading is preferred, but it
-dnl doesn't work under Mac (we need Python.bundle, but all we have is Python
-dnl framework which is a dylib and not a bundle)
if test "$USE_PYTHON" = 1; then
- if test "$USE_MAC" = 1; then
- USE_PYTHON="static"
- else
- USE_PYTHON="dynamic"
- fi
+ M_OVERRIDES(swig,whether we should use SWIG,USE_SWIG,1,
+ --without-swig do not use swig even if it is available)
fi
-case "$USE_PYTHON" in
- static|Static|STATIC|dynamic|Dynamic|DYNAMIC|1)
- M_OVERRIDES(swig,whether we should use SWIG,USE_SWIG,1,
- --without-swig don't use swig even if it is available)
- ;;
-esac
-
dnl dialup is not currently supported under Mac OS X
if test "$USE_MAC" = 0; then
M_OVERRIDES(dialup,special dial-up support,USE_DIALUP,1,
@@ -554,6 +541,9 @@ if test "x$USE_DIALUP" = "x1"; then
AC_DEFINE(USE_DIALUP)
fi
+dnl Find pkg-config outside of any conditional. Done before any PKG_* call.
+PKG_PROG_PKG_CONFIG
+
dnl --------------------------------------------------------------------------
dnl check for SSL
dnl --------------------------------------------------------------------------
@@ -737,120 +727,21 @@ dnl --------------------------------------------------------------------------
dnl which Python version are we going to use?
PYTHON_VER=
-dnl Check for Python headers first: we need this for both dynamic and static
-dnl linking
-case "$USE_PYTHON" in
-static|Static|STATIC|dynamic|Dynamic|DYNAMIC|1)
- for ver in 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.5; do
- M_CHECK_MYHEADER_VER(
- Python.h,
- $ver,
- [ \
- $prefix/include/python$ver \
- /usr/include/python$ver \
- /usr/local/include/python$ver \
- /System/Library/Frameworks/Python.framework/Versions/$ver/include/python$ver \
- ],
- [
- PYTHON_VER=$ver
- break
- ]
- )
- done
- if test "x$PYTHON_VER" = "x"; then
+if test "$USE_PYTHON" = 1; then
+ PKG_CHECK_MODULES(PYTHON, [python2],
+ [
+ CXXFLAGS="$PYTHON_CFLAGS $CXXFLAGS"
+ PYTHON_VER=`$PKG_CONFIG --modversion python2`
+ ],
+ [
USE_PYTHON=0
- fi
- ;;
-
-none|0)
- USE_PYTHON=0
- ;;
-
-*)
- USE_PYTHON=0
- AC_MSG_WARN(Unrecognized --with-python option value.)
- ;;
-esac
-
-dnl now check for the Python lib but only if linking statically
-case "$USE_PYTHON" in
-dynamic|Dynamic|DYNAMIC)
- if test "$USE_MAC" = 1; then
- AC_MSG_ERROR([Dynamic Python loading is not supported under Mac OS])
- fi
- AC_DEFINE(USE_PYTHON_DYNAMIC)
- ;;
-
-static|Static|STATIC|1)
- if test "$USE_MAC" = 1; then
- PYTHON_LIBS="-framework Python"
- AC_CACHE_CHECK(if we can link with Python framework,
- m_cv_framework_python,
- [
- LIBS_OLD=$LIBS
- LIBS="$LIBS $PYTHON_LIBS"
- AC_TRY_LINK([#include "python.h"],
- [Py_Initialize();],
- m_cv_framework_python=yes,
- m_cv_framework_python=no)
- LIBS="$LIBS_OLD"
- ])
- if test "$m_cv_framework_python" != "yes"; then
- PYTHON_LIBS=""
- fi
- fi
-
- if test "x$PYTHON_LIBS" = "x"; then
- M_CHECK_MYLIB(python$PYTHON_VER, main,
- [ \
- $prefix/lib \
- $prefix/lib/python$PYTHON_VER \
- $prefix/lib/python$PYTHON_VER/config \
- /usr/lib \
- /usr/lib/python$PYTHON_VER \
- /usr/lib/python$PYTHON_VER/config \
- /usr/local/lib \
- /usr/local/lib/python$PYTHON_VER \
- /usr/local/lib/python$PYTHON_VER/config \
- ],
- [
- VARNAME="libpath_python`echo $PYTHON_VER | sed 's/\./_/'`_main"
- PYTHON_LIBS="`eval echo $\`echo $VARNAME\`` -lpython$PYTHON_VER"
- ],
- [
- USE_PYTHON=0
- ])
- if test "$USE_PYTHON" != 0; then
- dnl extra libs required by python on freebsd
- case "$OSTYPE" in freebsd* | FreeBSD*)
- PYTHON_LIBS="-lreadline $PYTHON_LIBS"
- ;;
- esac
-
- dnl Python2 uses forkpty() and openpty() which are not in libc
- dnl under Linux but in libutil
- if test "$PYTHON_VER" != "1.5"; then
- AC_CHECK_FUNC(openpty,,
- AC_CHECK_LIB(util,openpty,
- PYTHON_LIBS="-lutil $PYTHON_LIBS"))
- fi
- fi
- fi
- ;;
-
-0)
- ;;
-
-*)
- AC_MSG_WARN(configure logic error, please report this bug)
- ;;
-esac
+ ]
+ )
+fi
case "$USE_PYTHON" in
0) MAKE_USE_PYTHON=''
AC_MSG_WARN([Mahogany will be built without embedded Python interpreter])
- PYTHON_LIBS=''
- PYTHON_VER=""
;;
*) AC_DEFINE(USE_PYTHON)
diff --git a/include/MPython.h b/include/MPython.h
index 61747a56..4adc2fe2 100644
--- a/include/MPython.h
+++ b/include/MPython.h
@@ -23,17 +23,6 @@
#undef HAVE_STRERROR
#undef HAVE_PROTOTYPES
#undef HAVE_STDARG_PROTOTYPES
-
- // use dynamic loading of Python DLL
- #ifndef USE_PYTHON_DYNAMIC
- #define USE_PYTHON_DYNAMIC
- #endif
-
- #ifdef USE_PYTHON_DYNAMIC
- // prevent Python.h from adding the library to our link settings (yes, it
- // really does it)
- #define USE_DL_EXPORT
- #endif // USE_PYTHON_DYNAMIC
#endif // OS_WIN
// under Linux we get annoying messages about redefinition of these symbols
@@ -94,374 +83,6 @@
#include <features.h>
#endif
-#ifdef USE_PYTHON_DYNAMIC
-
-#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
-typedef int Py_ssize_t;
-#endif
-
-// this function must be called before using any Python functions, it if
-// returns FALSE they can't be used
-extern bool InitPythonDll();
-
-// this one must be called if InitPythonDll() returned TRUE
-extern void FreePythonDll();
-
-// declare the wrappers
-extern "C"
-{
- /**
- Declare variable containing a pointer to Python function.
-
- This variable is later used instead of the real one with the help of
- redefinitions below. The macro also has a side effect of defining the
- type M_name_t for this function which is used elsewhere.
-
- This macro should be followed by a semicolon.
-
- @param rettype the return type of the function
- @param name name of the function
- @param args all function arguments inside parentheses
- */
- #define M_PY_WRAPPER_DECL(rettype, name, args) \
- typedef rettype (*M_##name##_t)args; \
- extern M_##name##_t M_##name
-
-
- /**
- Same as M_PY_WRAPPER_DECL but for a variable.
-
- This macro should be followed by a semicolon.
-
- @param type type of the variable
- @param name real name of the variable
- */
- #define M_PY_VAR_DECL(type, name) \
- typedef type M_##name##_t; \
- extern M_##name##_t M_##name
-
-
- // startup/shutdown
- M_PY_WRAPPER_DECL(void, Py_Initialize, (void));
- M_PY_WRAPPER_DECL(void, Py_Finalize, (void));
-
- // errors
- //M_PY_WRAPPER_DECL(int , PyErr_BadArgument, (void));
- M_PY_WRAPPER_DECL(void , PyErr_Clear, (void));
- M_PY_WRAPPER_DECL(void , PyErr_Fetch, (PyObject **, PyObject **, PyObject **));
- //M_PY_WRAPPER_DECL(PyObject * , PyErr_NoMemory, (void));
- M_PY_WRAPPER_DECL(PyObject * , PyErr_Occurred, (void));
- M_PY_WRAPPER_DECL(void , PyErr_Restore, (PyObject *, PyObject *, PyObject *));
- //M_PY_WRAPPER_DECL(void , PyErr_SetNone, (PyObject *));
- M_PY_WRAPPER_DECL(void , PyErr_SetString, (PyObject *, const char *));
- M_PY_WRAPPER_DECL(void , PyErr_SetObject, (PyObject *, PyObject *));
- M_PY_WRAPPER_DECL(PyObject *, PyErr_Format, (PyObject *, const char *, ...));
-
- // objects
- M_PY_WRAPPER_DECL(PyObject *, PyObject_Init, (PyObject *, PyTypeObject *));
- M_PY_WRAPPER_DECL(PyObject *, PyObject_Call, (PyObject *, PyObject *, PyObject *));
- M_PY_WRAPPER_DECL(PyObject *, PyObject_CallFunction, (PyObject *, char *format, ...));
- M_PY_WRAPPER_DECL(PyObject *, PyObject_CallFunctionObjArgs, (PyObject *, ...));
- M_PY_WRAPPER_DECL(PyObject *, PyObject_CallObject, (PyObject *, PyObject *));
- M_PY_WRAPPER_DECL(PyObject *, PyObject_GenericGetAttr, (PyObject *, PyObject *));
- M_PY_WRAPPER_DECL(PyObject *, PyObject_GetAttr, (PyObject *, PyObject *));
- M_PY_WRAPPER_DECL(PyObject *, PyObject_GetAttrString, (PyObject *, char *));
- M_PY_WRAPPER_DECL(int, PyObject_IsTrue, (PyObject *));
- M_PY_WRAPPER_DECL(void , PyObject_Free, (void *));
- M_PY_WRAPPER_DECL(void *, PyObject_Malloc, (size_t));
- M_PY_WRAPPER_DECL(int , PyObject_SetAttrString, (PyObject *, char *, PyObject *));
- M_PY_WRAPPER_DECL(int , PyObject_Size, (PyObject *));
- M_PY_WRAPPER_DECL(PyObject *, PyObject_Str, (PyObject *));
- M_PY_WRAPPER_DECL(void *, PyCObject_Import, (char *module_name, char *cobject_name));
- M_PY_WRAPPER_DECL(PyObject *, PyCObject_FromVoidPtr, (void *cobj, void (*destruct)(void*)));
- M_PY_WRAPPER_DECL(void *, PyCObject_AsVoidPtr, (PyObject *));
- M_PY_WRAPPER_DECL(PyObject **, _PyObject_GetDictPtr, (PyObject *));
-
- // instances
- M_PY_WRAPPER_DECL(PyObject *, PyInstance_NewRaw, (PyObject *, PyObject *));
- M_PY_WRAPPER_DECL(PyObject *, _PyInstance_Lookup, (PyObject *, PyObject *));
- M_PY_VAR_DECL(PyTypeObject *, PyInstance_Type);
-
- // integer types
- M_PY_WRAPPER_DECL(PyObject *, PyBool_FromLong, (long));
- M_PY_WRAPPER_DECL(long, PyInt_AsLong, (PyObject *));
- M_PY_WRAPPER_DECL(PyObject*, PyInt_FromLong, (long));
- M_PY_WRAPPER_DECL(PyObject *, PyLong_FromUnsignedLong, (unsigned long));
- M_PY_WRAPPER_DECL(PyObject *, PyLong_FromVoidPtr, (void *));
- M_PY_WRAPPER_DECL(long , PyLong_AsLong, (PyObject *));
- M_PY_WRAPPER_DECL(unsigned long , PyLong_AsUnsignedLong, (PyObject *));
- M_PY_WRAPPER_DECL(double, PyLong_AsDouble, (PyObject *));
- M_PY_VAR_DECL(PyTypeObject *, PyInt_Type);
- M_PY_VAR_DECL(PyTypeObject *, PyLong_Type);
- M_PY_VAR_DECL(PyIntObject *, _Py_TrueStruct);
- M_PY_VAR_DECL(PyIntObject *, _Py_ZeroStruct);
-
- // floats
- M_PY_VAR_DECL(PyTypeObject *, PyFloat_Type);
- M_PY_WRAPPER_DECL(PyObject *, PyFloat_FromDouble, (double));
- M_PY_WRAPPER_DECL(double, PyFloat_AsDouble, (PyObject *));
-
- // strings
- M_PY_WRAPPER_DECL(char *, PyString_AsString, (PyObject *));
- M_PY_WRAPPER_DECL(int , PyString_AsStringAndSize, (PyObject *, char **, Py_ssize_t *));
- M_PY_WRAPPER_DECL(void, PyString_ConcatAndDel, (PyObject **, PyObject *));
- M_PY_WRAPPER_DECL(PyObject *, PyString_Format, (PyObject *, PyObject *));
- M_PY_WRAPPER_DECL(PyObject *, PyString_FromString, (const char *));
- M_PY_WRAPPER_DECL(PyObject *, PyString_FromStringAndSize, (const char *, int));
- M_PY_WRAPPER_DECL(PyObject *, PyString_FromFormat, (const char *, ...));
- M_PY_WRAPPER_DECL(PyObject *, PyString_InternFromString, (const char *));
- M_PY_WRAPPER_DECL(int , PyString_Size, (PyObject *));
- M_PY_VAR_DECL(PyTypeObject* , PyString_Type);
-
- // tuples
- M_PY_WRAPPER_DECL(PyObject *, PyTuple_New, (int size));
- M_PY_WRAPPER_DECL(PyObject *, PyTuple_GetItem, (PyObject *, int));
- M_PY_WRAPPER_DECL(int *, PyTuple_SetItem, (PyObject *, int, PyObject *));
- M_PY_VAR_DECL(PyTypeObject * , PyTuple_Type);
-
- // dicts
- M_PY_WRAPPER_DECL(PyObject *, PyDict_GetItem, (PyObject *mp, PyObject *key));
- M_PY_WRAPPER_DECL(PyObject*, PyDict_GetItemString, (PyObject *, const char *));
- M_PY_WRAPPER_DECL(PyObject *, PyDict_New, (void));
- M_PY_WRAPPER_DECL(int, PyDict_SetItem, (PyObject *mp, PyObject *key, PyObject *item));
- M_PY_WRAPPER_DECL(int, PyDict_SetItemString, (PyObject *dp, const char *key, PyObject *item));
-
- // arguments
- M_PY_WRAPPER_DECL(int, PyArg_Parse, (PyObject *, char *, ...));
- M_PY_WRAPPER_DECL(int, PyArg_ParseTuple, (PyObject *, char *, ...));
- M_PY_WRAPPER_DECL(int, PyArg_UnpackTuple, (PyObject *, char *, int, int, ...));
-
- // other misc functions
- M_PY_WRAPPER_DECL(PyObject* , Py_VaBuildValue, (char *, va_list));
- M_PY_WRAPPER_DECL(void , _Py_Dealloc, (PyObject *));
- M_PY_WRAPPER_DECL(void, PyEval_RestoreThread, (PyThreadState *));
- M_PY_WRAPPER_DECL(PyThreadState*, PyEval_SaveThread, (void));
- M_PY_WRAPPER_DECL(PyObject*, PyList_GetItem, (PyObject *, int));
- M_PY_WRAPPER_DECL(PyObject*, PyList_New, (int size));
- M_PY_WRAPPER_DECL(int, PyList_Append, (PyObject *, PyObject *));
- M_PY_WRAPPER_DECL(int, PyList_SetItem, (PyObject *, int, PyObject *));
- M_PY_WRAPPER_DECL(int, PyList_Size, (PyObject *));
- M_PY_VAR_DECL(PyTypeObject *, PyList_Type);
- M_PY_WRAPPER_DECL(PyObject*, PyImport_ImportModule, (const char *));
- M_PY_WRAPPER_DECL(PyObject*, PyModule_GetDict, (PyObject *));
- M_PY_WRAPPER_DECL(int, PyModule_AddObject, (PyObject *, char *, PyObject *));
- M_PY_WRAPPER_DECL(int, PySys_SetObject, (char *, PyObject *));
- M_PY_VAR_DECL(PyTypeObject* , PyType_Type);
- M_PY_WRAPPER_DECL(PyObject*, Py_BuildValue, (char *, ...));
- M_PY_WRAPPER_DECL(PyObject*, Py_FindMethod, (PyMethodDef[], PyObject *, char *));
- M_PY_WRAPPER_DECL(PyObject*, Py_InitModule4, (char *, PyMethodDef *, char *, PyObject *, int));
- M_PY_WRAPPER_DECL(PyObject *, PyEval_CallObjectWithKeywords, (PyObject *, PyObject *, PyObject *));
- M_PY_WRAPPER_DECL(PyObject *, PyImport_AddModule, (char *name));
- M_PY_WRAPPER_DECL(PyObject *, PyImport_GetModuleDict, (void));
- M_PY_WRAPPER_DECL(PyObject *, PyImport_ReloadModule, (PyObject *));
- M_PY_WRAPPER_DECL(PyObject *, PyRun_String, (const char *, int, PyObject *, PyObject *));
- M_PY_WRAPPER_DECL(int, PyRun_SimpleStringFlags, (const char *, PyCompilerFlags *));
- M_PY_WRAPPER_DECL(int, PyOS_snprintf, (char *str, size_t size, const char *format, ...));
-
- M_PY_WRAPPER_DECL(int , PyType_IsSubtype, (PyTypeObject *, PyTypeObject *));
- M_PY_WRAPPER_DECL(void , _Py_NegativeRefcount, (const char *fname, int lineno, PyObject *op));
-
- // types
- M_PY_VAR_DECL(PyTypeObject *, PyBaseObject_Type);
- M_PY_VAR_DECL(PyTypeObject *, PyClass_Type);
- M_PY_VAR_DECL(PyTypeObject *, PyCFunction_Type);
- M_PY_VAR_DECL(PyTypeObject *, PyModule_Type);
- M_PY_VAR_DECL(PyTypeObject *, _PyWeakref_CallableProxyType);
- M_PY_VAR_DECL(PyTypeObject *, _PyWeakref_ProxyType);
-
- // variables
- M_PY_VAR_DECL(long, _Py_RefTotal);
- M_PY_VAR_DECL(PyObject *, _Py_NoneStruct);
- M_PY_VAR_DECL(PyObject *, _Py_NotImplementedStruct);
-
- // exception objects
- M_PY_VAR_DECL(PyObject *, PyExc_AttributeError);
- M_PY_VAR_DECL(PyObject *, PyExc_IOError);
- M_PY_VAR_DECL(PyObject *, PyExc_IndexError);
- M_PY_VAR_DECL(PyObject *, PyExc_MemoryError);
- M_PY_VAR_DECL(PyObject *, PyExc_NameError);
- M_PY_VAR_DECL(PyObject *, PyExc_NotImplementedError);
- M_PY_VAR_DECL(PyObject *, PyExc_OverflowError);
- M_PY_VAR_DECL(PyObject *, PyExc_RuntimeError);
- M_PY_VAR_DECL(PyObject *, PyExc_SyntaxError);
- M_PY_VAR_DECL(PyObject *, PyExc_SystemError);
- M_PY_VAR_DECL(PyObject *, PyExc_TypeError);
- M_PY_VAR_DECL(PyObject *, PyExc_ValueError);
- M_PY_VAR_DECL(PyObject *, PyExc_ZeroDivisionError);
-
- #undef M_PY_VAR_DECL
- #undef M_PY_WRAPPER_DECL
-}
-
-// redefine all functions we use to our wrappers instead
-// ----------------------------------------------------------------------------
-
-// startup/shutdown
-#define Py_Initialize M_Py_Initialize
-#define Py_Finalize M_Py_Finalize
-
-// errors
-#define PyErr_Clear M_PyErr_Clear
-#define PyErr_Fetch M_PyErr_Fetch
-#define PyErr_Occurred M_PyErr_Occurred
-#define PyErr_Restore M_PyErr_Restore
-#define PyErr_SetString M_PyErr_SetString
-#define PyErr_SetObject M_PyErr_SetObject
-#define PyErr_Format M_PyErr_Format
-
-// objects
-#define PyObject_Init M_PyObject_Init
-#define PyObject_Call M_PyObject_Call
-#define PyObject_CallFunction M_PyObject_CallFunction
-#define PyObject_CallFunctionObjArgs M_PyObject_CallFunctionObjArgs
-#define PyObject_CallObject M_PyObject_CallObject
-#define PyObject_GenericGetAttr M_PyObject_GenericGetAttr
-#define PyObject_GetAttr M_PyObject_GetAttr
-#define PyObject_GetAttrString M_PyObject_GetAttrString
-#define PyObject_IsTrue M_PyObject_IsTrue
-#if defined(WITH_PYMALLOC) && defined(PYMALLOC_DEBUG)
- #define _PyObject_DebugMalloc M_PyObject_Malloc
- #define _PyObject_DebugFree M_PyObject_Free
-#else
- #define PyObject_Malloc M_PyObject_Malloc
- #define PyObject_Free M_PyObject_Free
-#endif
-#define PyObject_SetAttrString M_PyObject_SetAttrString
-#define PyObject_Size M_PyObject_Size
-#define PyObject_Str M_PyObject_Str
-#define PyCObject_Import M_PyCObject_Import
-#define PyCObject_FromVoidPtr M_PyCObject_FromVoidPtr
-#define PyCObject_AsVoidPtr M_PyCObject_AsVoidPtr
-#define _PyObject_GetDictPtr M__PyObject_GetDictPtr
-
-// instances
-#define PyInstance_NewRaw M_PyInstance_NewRaw
-#define _PyInstance_Lookup M__PyInstance_Lookup
-#define PyInstance_Type (*M_PyInstance_Type)
-
-// integer types
-#define PyBool_FromLong M_PyBool_FromLong
-#define PyInt_AsLong M_PyInt_AsLong
-#define PyInt_FromLong M_PyInt_FromLong
-#define PyLong_FromUnsignedLong M_PyLong_FromUnsignedLong
-#define PyLong_FromVoidPtr M_PyLong_FromVoidPtr
-#define PyLong_AsLong M_PyLong_AsLong
-#define PyLong_AsUnsignedLong M_PyLong_AsUnsignedLong
-#define PyLong_AsDouble (*M_PyLong_AsDouble)
-#define PyInt_Type (*M_PyInt_Type)
-#define PyLong_Type (*M_PyLong_Type)
-#define _Py_TrueStruct (*M__Py_TrueStruct)
-#define _Py_ZeroStruct (*M__Py_ZeroStruct)
-
-// floats
-#define PyFloat_Type (*M_PyFloat_Type)
-#define PyFloat_FromDouble M_PyFloat_FromDouble
-#define PyFloat_AsDouble (*M_PyFloat_AsDouble)
-
-// strings
-#define PyString_AsString M_PyString_AsString
-#define PyString_AsStringAndSize M_PyString_AsStringAndSize
-#define PyString_ConcatAndDel M_PyString_ConcatAndDel
-#define PyString_Format M_PyString_Format
-#define PyString_FromString M_PyString_FromString
-#define PyString_FromStringAndSize M_PyString_FromStringAndSize
-#define PyString_FromFormat M_PyString_FromFormat
-#define PyString_InternFromString M_PyString_InternFromString
-#define PyString_Type (*M_PyString_Type)
-
-// tuples
-#define PyTuple_New M_PyTuple_New
-#define PyTuple_GetItem M_PyTuple_GetItem
-#define PyTuple_SetItem M_PyTuple_SetItem
-#define PyTuple_Type (*M_PyTuple_Type)
-
-// lists
-#define PyList_Type (*M_PyList_Type)
-#define PyList_New M_PyList_New
-#define PyList_SetItem M_PyList_SetItem
-#define PyList_Append M_PyList_Append
-
-// dicts
-#define PyDict_GetItem M_PyDict_GetItem
-#define PyDict_GetItemString M_PyDict_GetItemString
-#define PyDict_New M_PyDict_New
-#define PyDict_SetItem M_PyDict_SetItem
-#define PyDict_SetItemString M_PyDict_SetItemString
-
-// arguments
-#define PyArg_Parse M_PyArg_Parse
-#define PyArg_ParseTuple M_PyArg_ParseTuple
-#define PyArg_UnpackTuple M_PyArg_UnpackTuple
-
-// types: these are objects and not function pointers
-#define PyBaseObject_Type (*M_PyBaseObject_Type)
-#define PyClass_Type (*M_PyClass_Type)
-#define PyCFunction_Type (*M_PyCFunction_Type)
-#define PyModule_Type (*M_PyModule_Type)
-#define _PyWeakref_CallableProxyType (*M__PyWeakref_CallableProxyType)
-#define _PyWeakref_ProxyType (*M__PyWeakref_ProxyType)
-
-// ...
-#define _Py_NoneStruct (*M__Py_NoneStruct)
-#define _Py_NotImplementedStruct (*M__Py_NotImplementedStruct)
-#define Py_BuildValue M_Py_BuildValue
-#define Py_VaBuildValue M_Py_VaBuildValue
-#define _Py_RefTotal M__Py_RefTotal
-#define PyImport_ImportModule M_PyImport_ImportModule
-#define PyModule_GetDict M_PyModule_GetDict
-#define PyModule_AddObject M_PyModule_AddObject
-#define PyType_Type (*M_PyType_Type)
-#define PyEval_CallObjectWithKeywords M_PyEval_CallObjectWithKeywords
-#define PyImport_AddModule M_PyImport_AddModule
-#define PyImport_GetModuleDict M_PyImport_GetModuleDict
-#define PyImport_ReloadModule M_PyImport_ReloadModule
-// PyRun_String is already a macro in 2.6 but, surprisingly, the DLL still
-// exports it as a function too and using it seems to work fine...
-#undef PyRun_String
-#define PyRun_String M_PyRun_String
-#define PyRun_SimpleStringFlags M_PyRun_SimpleStringFlags
-#define PyOS_snprintf M_PyOS_snprintf
-
-// exception objects
-#define PyExc_AttributeError M_PyExc_AttributeError
-#define PyExc_IOError M_PyExc_IOError
-#define PyExc_IndexError M_PyExc_IndexError
-#define PyExc_MemoryError M_PyExc_MemoryError
-#define PyExc_NameError M_PyExc_NameError
-#define PyExc_NotImplementedError M_PyExc_NotImplementedError
-#define PyExc_OverflowError M_PyExc_OverflowError
-#define PyExc_RuntimeError M_PyExc_RuntimeError
-#define PyExc_SyntaxError M_PyExc_SyntaxError
-#define PyExc_SystemError M_PyExc_SystemError
-#define PyExc_TypeError M_PyExc_TypeError
-#define PyExc_ValueError M_PyExc_ValueError
-#define PyExc_ZeroDivisionError M_PyExc_ZeroDivisionError
-
-// Python 2.3+
-#define PyType_IsSubtype M_PyType_IsSubtype
-#define _Py_NegativeRefcount M__Py_NegativeRefcount
-
-// _Py_Dealloc may be defined as a macro or not (in debug builds)
-#ifndef _Py_Dealloc
-#define _Py_Dealloc M__Py_Dealloc
-#endif
-
-// Py_InitModule4 may be defined as Py_InitModule4TraceRefs (in debug builds)
-#ifdef Py_TRACE_REFS
-#define Py_InitModule4TraceRefs M_Py_InitModule4
-#define M_Py_InitModule4TraceRefs M_Py_InitModule4
-#else
-// Another complication: under 64 bit systems Python uses a different name to
-// avoid loading 32 bit modules into 64 bit interpreter
-#if SIZEOF_SIZE_T != SIZEOF_INT
-#define Py_InitModule4_64 M_Py_InitModule4
-#else
-#define Py_InitModule4 M_Py_InitModule4
-#endif
-#endif
-
-#endif // USE_PYTHON_DYNAMIC
-
#include "PythonHelp.h"
#define M_PYTHON_MODULE "Minit"
diff --git a/include/config.h.in b/include/config.h.in
index 2f88ad6c..3d4b746d 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -49,9 +49,6 @@
/** Define if you use Python. */
#undef USE_PYTHON
-/** Define to load Python library during run-time */
-#undef USE_PYTHON_DYNAMIC
-
/** Define if you have libswigpy */
#undef HAVE_SWIGLIB
diff --git a/src/Python/InitPython.cpp b/src/Python/InitPython.cpp
index ca10dba9..874a9403 100644
--- a/src/Python/InitPython.cpp
+++ b/src/Python/InitPython.cpp
@@ -136,16 +136,6 @@ InitPython(void)
return true;
}
- // check if Python is available at all if we load it during run-time
-#ifdef USE_PYTHON_DYNAMIC
- if ( !InitPythonDll() )
- {
- wxLogError(_("Python dynamic library couldn't be loaded."));
-
- return false;
- }
-#endif // USE_PYTHON_DYNAMIC
-
// initialise the interpreter -- this we do always, just to avoid problems
Py_Initialize();
gs_isPythonInitialized = true;
@@ -209,10 +199,6 @@ void FreePython()
gs_isPythonInitialized = false;
}
-
-#ifdef USE_PYTHON_DYNAMIC
- FreePythonDll();
-#endif // USE_PYTHON_DYNAMIC
}
#endif // USE_PYTHON
diff --git a/src/Python/Names.mk b/src/Python/Names.mk
index fbdb53b7..bb3ee793 100644
--- a/src/Python/Names.mk
+++ b/src/Python/Names.mk
@@ -7,7 +7,7 @@ ifdef USE_PYTHON
IFACE_DIR := .src/../include/interface
IFILES := $(filter-out swigcmn.i, $(notdir $(wildcard $(IFACE_DIR)/*.i)))
-MSRC := Python/InitPython.cpp Python/PythonHelp.cpp Python/PythonDll.cpp
+MSRC := Python/InitPython.cpp Python/PythonHelp.cpp
MOBJS += $(patsubst %.i,Python/%.o,$(IFILES)) $(MSRC:.cpp=.o)
MSGSRC += $(MSRC)
diff --git a/src/Python/PythonDll.cpp b/src/Python/PythonDll.cpp
deleted file mode 100644
index 178fd73b..00000000
--- a/src/Python/PythonDll.cpp
+++ /dev/null
@@ -1,506 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Project: M
-// File name: PythonDll.cpp - stubs for Python functions
-// Purpose: to allow real dynamic loading of Python.dll under Windows
-// we resolve the Python functions we use at run-time, otherwise
-// we'd need to always distribute Python.dll with Mahogany
-// Author: Vadim Zeitlin
-// Modified by:
-// Created: 11.03.01
-// CVS-ID: $Id$
-// Copyright: (c) 2001 Vadim Zeitlin <[email protected]>
-// Licence: M license
-///////////////////////////////////////////////////////////////////////////////
-
-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-
-#include "Mpch.h"
-
-#ifndef USE_PCH
- #include "Mcommon.h"
- #include "Mdefaults.h"
- #include "MApplication.h"
-#endif // USE_PCH
-
-#include "MPython.h"
-
-#ifdef USE_PYTHON_DYNAMIC
-
-#include <wx/dynlib.h>
-
-// ----------------------------------------------------------------------------
-// options we use here
-// ----------------------------------------------------------------------------
-
-extern const MOption MP_PYTHONDLL;
-
-// ----------------------------------------------------------------------------
-// local functions
-// ----------------------------------------------------------------------------
-
-namespace
-{
-
-// return the full name of the Python library with the given version
-inline String GetPythonDllBaseName(int major, int minor)
-{
-#if defined(OS_WIN)
- String basename = wxString::Format("python%d%d", major, minor);
-
- // we used to append "_d" to the base name here in debug build of M to
- // ensure that Python DLL we load uses the same CRT version as we do
- //
- // however it finally doesn't seem necessary to require this and we can
- // always the release version of Python DLL, even when building M itself in
- // debug, if we just #undef _DEBUG prior to including Python.h (as we now
- // do)
- //
- // this seems to work with at least Python 2.6 (compiled with VC9) and we
- // may always restore the basename += "_d"; line if we find any problems
-#elif defined(OS_UNIX)
- String basename = wxString::Format("libpython%d.%d", major, minor);
-#else
- #error "Unknown Python library naming convention under this OS"
-#endif // OS
-
- return basename;
-}
-
-} // anonymous namespace
-
-// ----------------------------------------------------------------------------
-// global data
-// ----------------------------------------------------------------------------
-
-#define M_PY_WRAPPER_DEF(name) M_##name##_t M_##name = NULL
-
-// use 0 and not NULL as not all variables are pointers
-#define M_PY_VAR_DEF(name) M_##name##_t M_##name = 0
-
-extern "C"
-{
- M_PY_WRAPPER_DEF(Py_Initialize);
- M_PY_WRAPPER_DEF(Py_Finalize);
-
- // errors
- //M_PY_WRAPPER_DEF(PyErr_BadArgument);
- M_PY_WRAPPER_DEF(PyErr_Clear);
- M_PY_WRAPPER_DEF(PyErr_Fetch);
- //M_PY_WRAPPER_DEF(PyErr_NoMemory);
- M_PY_WRAPPER_DEF(PyErr_Occurred);
- M_PY_WRAPPER_DEF(PyErr_Restore);
- //M_PY_WRAPPER_DEF(PyErr_SetNone);
- M_PY_WRAPPER_DEF(PyErr_SetString);
- M_PY_WRAPPER_DEF(PyErr_SetObject);
- M_PY_WRAPPER_DEF(PyErr_Format);
-
- // objects
- M_PY_WRAPPER_DEF(PyObject_Init);
- M_PY_WRAPPER_DEF(PyObject_Call);
- M_PY_WRAPPER_DEF(PyObject_CallFunction);
- M_PY_WRAPPER_DEF(PyObject_CallFunctionObjArgs);
- M_PY_WRAPPER_DEF(PyObject_CallObject);
- M_PY_WRAPPER_DEF(PyObject_Free);
- M_PY_WRAPPER_DEF(PyObject_GenericGetAttr);
- M_PY_WRAPPER_DEF(PyObject_GetAttr);
- M_PY_WRAPPER_DEF(PyObject_GetAttrString);
- M_PY_WRAPPER_DEF(PyObject_IsTrue);
- M_PY_WRAPPER_DEF(PyObject_Malloc);
- M_PY_WRAPPER_DEF(PyObject_SetAttrString);
- M_PY_WRAPPER_DEF(PyObject_Size);
- M_PY_WRAPPER_DEF(PyObject_Str);
- M_PY_WRAPPER_DEF(PyCObject_Import);
- M_PY_WRAPPER_DEF(PyCObject_FromVoidPtr);
- M_PY_WRAPPER_DEF(PyCObject_AsVoidPtr);
- M_PY_WRAPPER_DEF(_PyObject_GetDictPtr);
-
- // instances
- M_PY_WRAPPER_DEF(PyInstance_NewRaw);
- M_PY_WRAPPER_DEF(_PyInstance_Lookup);
- M_PY_VAR_DEF(PyInstance_Type);
-
- // integer types
- M_PY_WRAPPER_DEF(PyBool_FromLong);
- M_PY_WRAPPER_DEF(PyInt_AsLong);
- M_PY_WRAPPER_DEF(PyInt_FromLong);
- M_PY_WRAPPER_DEF(PyLong_FromUnsignedLong);
- M_PY_WRAPPER_DEF(PyLong_FromVoidPtr);
- M_PY_WRAPPER_DEF(PyLong_AsLong);
- M_PY_WRAPPER_DEF(PyLong_AsUnsignedLong);
- M_PY_WRAPPER_DEF(PyLong_AsDouble);
- M_PY_VAR_DEF(PyInt_Type);
- M_PY_VAR_DEF(PyLong_Type);
- M_PY_VAR_DEF(_Py_TrueStruct);
- M_PY_VAR_DEF(_Py_ZeroStruct);
-
- // floats
- M_PY_VAR_DEF(PyFloat_Type);
- M_PY_WRAPPER_DEF(PyFloat_FromDouble);
- M_PY_WRAPPER_DEF(PyFloat_AsDouble);
-
- // strings
- M_PY_WRAPPER_DEF(PyString_AsString);
- M_PY_WRAPPER_DEF(PyString_AsStringAndSize);
- M_PY_WRAPPER_DEF(PyString_ConcatAndDel);
- M_PY_WRAPPER_DEF(PyString_Format);
- M_PY_WRAPPER_DEF(PyString_FromString);
- M_PY_WRAPPER_DEF(PyString_FromStringAndSize);
- M_PY_WRAPPER_DEF(PyString_FromFormat);
- M_PY_WRAPPER_DEF(PyString_InternFromString);
- M_PY_WRAPPER_DEF(PyString_Size);
- M_PY_VAR_DEF(PyString_Type);
-
- // tuples
- M_PY_WRAPPER_DEF(PyTuple_New);
- M_PY_WRAPPER_DEF(PyTuple_GetItem);
- M_PY_WRAPPER_DEF(PyTuple_SetItem);
- M_PY_VAR_DEF(PyTuple_Type);
-
- // dicts
- M_PY_WRAPPER_DEF(PyDict_GetItem);
- M_PY_WRAPPER_DEF(PyDict_GetItemString);
- M_PY_WRAPPER_DEF(PyDict_New);
- M_PY_WRAPPER_DEF(PyDict_SetItem);
- M_PY_WRAPPER_DEF(PyDict_SetItemString);
-
- // args
- M_PY_WRAPPER_DEF(PyArg_Parse);
- M_PY_WRAPPER_DEF(PyArg_ParseTuple);
- M_PY_WRAPPER_DEF(PyArg_UnpackTuple);
-
- // ...
- M_PY_WRAPPER_DEF(Py_VaBuildValue);
- M_PY_WRAPPER_DEF(_Py_Dealloc);
- M_PY_WRAPPER_DEF(PyEval_RestoreThread);
- M_PY_WRAPPER_DEF(PyEval_SaveThread);
- M_PY_WRAPPER_DEF(PyList_GetItem);
- M_PY_WRAPPER_DEF(PyList_New);
- M_PY_WRAPPER_DEF(PyList_Append);
- M_PY_WRAPPER_DEF(PyList_SetItem);
- M_PY_WRAPPER_DEF(PyList_Size);
- M_PY_VAR_DEF(PyList_Type);
- M_PY_WRAPPER_DEF(PyImport_ImportModule);
- M_PY_WRAPPER_DEF(PyModule_GetDict);
- M_PY_WRAPPER_DEF(PyModule_AddObject);
- M_PY_WRAPPER_DEF(PySys_SetObject);
- M_PY_VAR_DEF(PyType_Type);
- M_PY_WRAPPER_DEF(Py_BuildValue);
- M_PY_WRAPPER_DEF(Py_FindMethod);
- M_PY_WRAPPER_DEF(Py_InitModule4);
- M_PY_WRAPPER_DEF(PyEval_CallObjectWithKeywords);
- M_PY_WRAPPER_DEF(PyImport_AddModule);
- M_PY_WRAPPER_DEF(PyImport_GetModuleDict);
- M_PY_WRAPPER_DEF(PyImport_ReloadModule);
- M_PY_WRAPPER_DEF(PyRun_String);
- M_PY_WRAPPER_DEF(PyRun_SimpleStringFlags);
-
- M_PY_WRAPPER_DEF(PyType_IsSubtype);
- M_PY_WRAPPER_DEF(_Py_NegativeRefcount);
-
- // other misc functions
- M_PY_WRAPPER_DEF(PyOS_snprintf);
-
- // misc types
- M_PY_VAR_DEF(PyBaseObject_Type);
- M_PY_VAR_DEF(PyClass_Type);
- M_PY_VAR_DEF(PyCFunction_Type);
- M_PY_VAR_DEF(PyModule_Type);
- M_PY_VAR_DEF(_PyWeakref_CallableProxyType);
- M_PY_VAR_DEF(_PyWeakref_ProxyType);
-
- // variables
-#ifdef Py_REF_DEBUG
- M_PY_VAR_DEF(_Py_RefTotal);
-#endif // Py_REF_DEBUG
- M_PY_VAR_DEF(_Py_NoneStruct);
- M_PY_VAR_DEF(_Py_NotImplementedStruct);
-
- // exception objects
- M_PY_VAR_DEF(PyExc_AttributeError);
- M_PY_VAR_DEF(PyExc_IOError);
- M_PY_VAR_DEF(PyExc_IndexError);
- M_PY_VAR_DEF(PyExc_MemoryError);
- M_PY_VAR_DEF(PyExc_NameError);
- M_PY_VAR_DEF(PyExc_NotImplementedError);
- M_PY_VAR_DEF(PyExc_OverflowError);
- M_PY_VAR_DEF(PyExc_RuntimeError);
- M_PY_VAR_DEF(PyExc_SyntaxError);
- M_PY_VAR_DEF(PyExc_SystemError);
- M_PY_VAR_DEF(PyExc_TypeError);
- M_PY_VAR_DEF(PyExc_ValueError);
- M_PY_VAR_DEF(PyExc_ZeroDivisionError);
-}
-
-#undef M_PY_VAR_DEF
-#undef M_PY_WRAPPER_DEF
-
-// ----------------------------------------------------------------------------
-// private data
-// ----------------------------------------------------------------------------
-
-#ifdef OS_WIN
- #define PYTHON_PROC FARPROC
-#else
- #define PYTHON_PROC void *
-#endif
-
-#define PYTHON_SYMBOL(func) { #func, (PYTHON_PROC *)&M_ ## func },
-
-static struct PythonFunc
-{
- const char *name; // function name
- PYTHON_PROC *ptr; // function pointer
-} pythonFuncs[] =
-{
- // startup/shutdown
- PYTHON_SYMBOL(Py_Initialize)
- PYTHON_SYMBOL(Py_Finalize)
-
- // errors
- PYTHON_SYMBOL(PyErr_Clear)
- PYTHON_SYMBOL(PyErr_Fetch)
- PYTHON_SYMBOL(PyErr_Occurred)
- PYTHON_SYMBOL(PyErr_Restore)
- PYTHON_SYMBOL(PyErr_SetString)
- PYTHON_SYMBOL(PyErr_SetObject)
- PYTHON_SYMBOL(PyErr_Format)
-
- // objects
- PYTHON_SYMBOL(PyObject_Init)
- PYTHON_SYMBOL(PyObject_Call)
- PYTHON_SYMBOL(PyObject_CallFunction)
- PYTHON_SYMBOL(PyObject_CallFunctionObjArgs)
- PYTHON_SYMBOL(PyObject_CallObject)
- PYTHON_SYMBOL(PyObject_Free)
- PYTHON_SYMBOL(PyObject_GenericGetAttr)
- PYTHON_SYMBOL(PyObject_GetAttr)
- PYTHON_SYMBOL(PyObject_GetAttrString)
- PYTHON_SYMBOL(PyObject_IsTrue)
- PYTHON_SYMBOL(PyObject_Malloc)
- PYTHON_SYMBOL(PyObject_SetAttrString)
- PYTHON_SYMBOL(PyObject_Size)
- PYTHON_SYMBOL(PyObject_Str)
- PYTHON_SYMBOL(PyCObject_Import)
- PYTHON_SYMBOL(PyCObject_FromVoidPtr)
- PYTHON_SYMBOL(PyCObject_AsVoidPtr)
- PYTHON_SYMBOL(_PyObject_GetDictPtr)
-
- // instances
- PYTHON_SYMBOL(PyInstance_NewRaw)
- PYTHON_SYMBOL(PyInstance_Type)
- PYTHON_SYMBOL(_PyInstance_Lookup)
-
- // integer types
- PYTHON_SYMBOL(PyBool_FromLong)
- PYTHON_SYMBOL(PyInt_AsLong)
- PYTHON_SYMBOL(PyInt_FromLong)
- PYTHON_SYMBOL(PyLong_FromUnsignedLong)
- PYTHON_SYMBOL(PyLong_FromVoidPtr)
- PYTHON_SYMBOL(PyLong_AsLong)
- PYTHON_SYMBOL(PyLong_AsUnsignedLong)
- PYTHON_SYMBOL(PyLong_AsDouble)
- PYTHON_SYMBOL(PyInt_Type)
- PYTHON_SYMBOL(PyLong_Type)
- PYTHON_SYMBOL(_Py_TrueStruct)
- PYTHON_SYMBOL(_Py_ZeroStruct)
-
- // floats
- PYTHON_SYMBOL(PyFloat_Type)
- PYTHON_SYMBOL(PyFloat_FromDouble)
- PYTHON_SYMBOL(PyFloat_AsDouble)
-
- // strings
- PYTHON_SYMBOL(PyString_AsString)
- PYTHON_SYMBOL(PyString_AsStringAndSize)
- PYTHON_SYMBOL(PyString_ConcatAndDel)
- PYTHON_SYMBOL(PyString_Format)
- PYTHON_SYMBOL(PyString_FromString)
- PYTHON_SYMBOL(PyString_FromStringAndSize)
- PYTHON_SYMBOL(PyString_FromFormat)
- PYTHON_SYMBOL(PyString_InternFromString)
- PYTHON_SYMBOL(PyString_Type)
-
- // tuples
- PYTHON_SYMBOL(PyTuple_New)
- PYTHON_SYMBOL(PyTuple_GetItem)
- PYTHON_SYMBOL(PyTuple_SetItem)
- PYTHON_SYMBOL(PyTuple_Type)
-
- // dicts
- PYTHON_SYMBOL(PyDict_GetItem)
- PYTHON_SYMBOL(PyDict_GetItemString)
- PYTHON_SYMBOL(PyDict_New)
- PYTHON_SYMBOL(PyDict_SetItem)
- PYTHON_SYMBOL(PyDict_SetItemString)
-
- // args
- PYTHON_SYMBOL(PyArg_Parse)
- PYTHON_SYMBOL(PyArg_ParseTuple)
- PYTHON_SYMBOL(PyArg_UnpackTuple)
-
- // ...
- PYTHON_SYMBOL(_Py_NoneStruct)
- PYTHON_SYMBOL(_Py_NotImplementedStruct)
- PYTHON_SYMBOL(PyCFunction_Type)
- PYTHON_SYMBOL(Py_BuildValue)
- PYTHON_SYMBOL(Py_VaBuildValue)
-#ifdef Py_REF_DEBUG
- PYTHON_SYMBOL(_Py_RefTotal)
-#endif // Py_REF_DEBUG
-#ifdef Py_TRACE_REFS
- PYTHON_SYMBOL(_Py_Dealloc)
-#endif // Py_TRACE_REFS
-
- // misc types
- PYTHON_SYMBOL(PyBaseObject_Type)
- PYTHON_SYMBOL(PyClass_Type)
- PYTHON_SYMBOL(PyModule_Type)
- PYTHON_SYMBOL(_PyWeakref_CallableProxyType)
- PYTHON_SYMBOL(_PyWeakref_ProxyType)
-
- PYTHON_SYMBOL(PyImport_ImportModule)
- PYTHON_SYMBOL(PyModule_GetDict)
- PYTHON_SYMBOL(PyModule_AddObject)
- PYTHON_SYMBOL(PyEval_CallObjectWithKeywords)
-
- PYTHON_SYMBOL(PyExc_AttributeError)
- PYTHON_SYMBOL(PyExc_IOError)
- PYTHON_SYMBOL(PyExc_IndexError)
- PYTHON_SYMBOL(PyExc_MemoryError)
- PYTHON_SYMBOL(PyExc_NameError)
- PYTHON_SYMBOL(PyExc_NotImplementedError)
- PYTHON_SYMBOL(PyExc_OverflowError)
- PYTHON_SYMBOL(PyExc_RuntimeError)
- PYTHON_SYMBOL(PyExc_SyntaxError)
- PYTHON_SYMBOL(PyExc_SystemError)
- PYTHON_SYMBOL(PyExc_TypeError)
- PYTHON_SYMBOL(PyExc_ValueError)
- PYTHON_SYMBOL(PyExc_ZeroDivisionError)
-
- PYTHON_SYMBOL(PyImport_AddModule)
- PYTHON_SYMBOL(PyImport_GetModuleDict)
- PYTHON_SYMBOL(PyImport_ReloadModule)
- PYTHON_SYMBOL(PyRun_String)
- PYTHON_SYMBOL(PyRun_SimpleStringFlags)
- PYTHON_SYMBOL(PyType_IsSubtype)
-
- // special case of Py_InitModule() which has different names in different
- // Python builds
- {
-#ifdef Py_TRACE_REFS
- "Py_InitModule4TraceRefs",
-#elif SIZEOF_SIZE_T != SIZEOF_INT
- "Py_InitModule4_64",
-#else
- "Py_InitModule4",
-#endif
- (PYTHON_PROC *)&M_Py_InitModule4
- },
-
- { "", NULL }
-};
-
-// the handle of Python DLL
-static wxDllType gs_dllPython = 0;
-
-// ----------------------------------------------------------------------------
-// public API
-// ----------------------------------------------------------------------------
-
-extern bool InitPythonDll()
-{
- CHECK( !gs_dllPython, true, _T("shouldn't be called more than once") );
-
- // supported Python versions: probably not all of them (still) work,
- // currently only 2.[45] under Linux and 2.6 under Windows are really known
- // to work
- static const struct PythonVersion
- {
- int major,
- minor;
- } pythonVersions[] =
- {
- { 1, 5 },
- { 2, 0 },
- { 2, 2 },
- { 2, 4 },
- { 2, 5 },
- { 2, 6 },
- };
-
- // load the library
- wxDynamicLibrary dllPython;
-
- String pathDLL = READ_APPCONFIG(MP_PYTHONDLL);
- if ( !pathDLL.empty() )
- {
- // directly use the Python DLL configured by the user
- dllPython.Load(pathDLL);
- }
- else // try to find the DLL ourselves
- {
- // don't give errors about missing DLL here
- wxLogNull noLog;
-
- const String ext = wxDynamicLibrary::GetDllExt();
-
- // try all supported versions starting with the most recent one
- for ( size_t nVer = WXSIZEOF(pythonVersions); nVer > 0; nVer-- )
- {
- const PythonVersion& ver = pythonVersions[nVer - 1];
- String name = GetPythonDllBaseName(ver.major, ver.minor);
-
- if ( dllPython.Load(name + ext) )
- break;
- }
- }
-
- if ( !dllPython.IsLoaded() )
- {
- if ( pathDLL.empty() )
- wxLogError(_("No suitable Python DLL could be found."));
- else
- wxLogError(_("Python DLL \"%s\" couldn't be loaded."), pathDLL);
-
- return false;
- }
-
- // load all functions
- PythonFunc *pf = pythonFuncs;
- while ( pf->ptr )
- {
- void *funcptr = dllPython.GetSymbol(pf->name);
-
- if ( !funcptr )
- {
- // error message is already given by GetSymbol()
- FreePythonDll();
-
- return false;
- }
-
- *(pf++->ptr) = (PYTHON_PROC)funcptr;
- }
-
- gs_dllPython = dllPython.Detach();
-
- return true;
-}
-
-extern void FreePythonDll()
-{
- if ( gs_dllPython )
- {
- wxDynamicLibrary::Unload(gs_dllPython);
- gs_dllPython = 0;
- }
-}
-
-#endif // USE_PYTHON_DYNAMIC
-
diff --git a/src/gui/wxOptionsDlg.cpp b/src/gui/wxOptionsDlg.cpp
index ff2c8d40..0ac02eee 100644
--- a/src/gui/wxOptionsDlg.cpp
+++ b/src/gui/wxOptionsDlg.cpp
@@ -72,7 +72,6 @@
#include "FolderView.h"
#include "TemplateDialog.h"
-#include "MPython.h" // defines USE_PYTHON_DYNAMIC
#include "InitPython.h"
#include "ColourNames.h"
@@ -354,10 +353,6 @@ enum ConfigFields
ConfigField_PythonFirst = ConfigField_FoldersLast,
ConfigField_Python_HelpText,
ConfigField_EnablePython,
-#ifdef USE_PYTHON_DYNAMIC
- ConfigField_PythonDll_Help,
- ConfigField_PythonDll,
-#endif // USE_PYTHON_DYNAMIC
ConfigField_PythonPath_Help,
ConfigField_PythonPath,
ConfigField_PythonModuleToLoad_Help,
@@ -1500,14 +1495,6 @@ const wxOptionsPage::FieldInfo wxOptionsPageStandard::ms_aFields[] =
Field_AppWide, -1 },
{ gettext_noop("&Enable Python"), Field_Bool |
Field_AppWide, -1, },
-#ifdef USE_PYTHON_DYNAMIC
- { gettext_noop("If Mahogany can't find Python shared library in one of\n"
- "the standard locations, you may enter full path to it here\n"),
- Field_Message |
- Field_AppWide, ConfigField_EnablePython },
- { gettext_noop("Python &DLL"), Field_File |
- Field_AppWide, ConfigField_EnablePython },
-#endif // USE_PYTHON_DYNAMIC
{ gettext_noop("The option below determines where Mahogany should look for\n"
"Python modules (in addition to standard places)"), Field_Message |
Field_AppWide, ConfigField_EnablePython },
@@ -2162,10 +2149,6 @@ const ConfigValueDefault wxOptionsPageStandard::ms_aConfigDefaults[] =
#ifdef USE_PYTHON
CONFIG_NONE(),
CONFIG_ENTRY(MP_USEPYTHON),
-#ifdef USE_PYTHON_DYNAMIC
- CONFIG_NONE(),
- CONFIG_ENTRY(MP_PYTHONDLL),
-#endif // USE_PYTHON_DYNAMIC
CONFIG_NONE(),
CONFIG_ENTRY(MP_PYTHONPATH),
CONFIG_NONE(),
commit 1332f9adccc91bd66699992d85bb2adb8f9cc235
Author: Vadim Zeitlin <[email protected]>
Date: Sat Mar 30 17:24:32 2024 +0100
Work around listing update problems with wxGTK/Wayland
Somehow, refreshing items directly from the idle event handler didn't
work when using Wayland: they were refreshed and repainted, but the
results didn't appear on the screen, unlike when using X11 (or MSW for
that matter).
Work around it by calling RefreshItems() later: this shouldn't normally
change anything, but it does fix the problem.
See https://github.com/wxWidgets/wxWidgets/issues/24443
diff --git a/src/gui/wxFolderView.cpp b/src/gui/wxFolderView.cpp
index 5866470b..2cd7829f 100644
--- a/src/gui/wxFolderView.cpp
+++ b/src/gui/wxFolderView.cpp
@@ -2601,7 +2601,12 @@ void wxFolderListCtrl::OnIdle(wxIdleEvent& event)
// now the header info should be in cache, so GetHeaderInfo() will
// return it
- RefreshItems(posMin, posMax);
+ //
+ // don't call RefreshItems() from here because it somehow doesn't work,
+ // see https://github.com/wxWidgets/wxWidgets/issues/24443
+ CallAfter([this, posMin, posMax]() {
+ RefreshItems(posMin, posMax);
+ });
}
}
commit 7dc61e5df661fd3fd90395b7922ccc9ba7d24088
Author: Vadim Zeitlin <[email protected]>
Date: Sat Mar 30 17:23:23 2024 +0100
Avoid reentrancies in wxFolderListCtrl with wxGTK
We could call GetHeaderInfo() from inside CachePositions() which was
definitely unexpected even if it's unclear if it was actually harmful,
so don't do it.
diff --git a/src/gui/wxFolderView.cpp b/src/gui/wxFolderView.cpp
index 11d8c5e7..5866470b 100644
--- a/src/gui/wxFolderView.cpp
+++ b/src/gui/wxFolderView.cpp
@@ -2992,6 +2992,13 @@ wxString wxFolderListCtrl::OnGetItemText(long item, long column) const
return text;
}
+ // We can get here if the window is being repainted while some other
+ // operation is already being executed, notably under wxGTK calling
+ // wxLogStatus(), as done by HeaderInfoList, results in wxEVT_PAINT
+ // generation.
+ if ( m_mutexHeaders.IsLocked() || !mApplication->AllowBgProcessing() )
+ return text;
+
HeaderInfo *hi = GetHeaderInfo((size_t)item);
if ( !hi )
{
commit dce8a08344eeee58b79365683a7ae4f01fe43898
Author: Vadim Zeitlin <[email protected]>
Date: Sat Mar 30 17:22:33 2024 +0100
Use the same email for all commits by Vadim Zeitlin
Map "vadim" email accidentally used for some commits ot "vz-mahogany"
one used for most of them.
diff --git a/.mailmap b/.mailmap
index 333d359f..913709bc 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1,2 +1,3 @@
Nerijus Baliƫnas <[email protected]> Nerijus Baliunas <[email protected]>
Nerijus Baliƫnas <[email protected]> Nerijus <[email protected]>
+Vadim Zeitlin <[email protected]> Vadim Zeitlin <[email protected]>
commit eda0a65555519761ac608c6d509ee13201ebefa4
Author: Vadim Zeitlin <[email protected]>
Date: Sat Mar 30 17:20:57 2024 +0100
Fix typo in a comment in wxFolderListCtrl
No real changes.
diff --git a/src/gui/wxFolderView.cpp b/src/gui/wxFolderView.cpp
index 109dbf90..11d8c5e7 100644
--- a/src/gui/wxFolderView.cpp
+++ b/src/gui/wxFolderView.cpp
@@ -2433,7 +2433,7 @@ HeaderInfo *wxFolderListCtrl::GetHeaderInfo(size_t index) const
if ( !m_headers->Count() )
{
- // this probably menas that we lost the connection unexpectedly
+ // this probably means that we lost the connection unexpectedly
return NULL;
}
}
-----------------------------------------------------------------------
Summary of changes:
.mailmap | 1 +
acinclude.m4 | 37 ----
configure.ac | 141 ++-----------
include/MPython.h | 379 ----------------------------------
include/config.h.in | 3 -
src/Python/InitPython.cpp | 14 --
src/Python/Names.mk | 2 +-
src/Python/PythonDll.cpp | 506 ----------------------------------------------
src/gui/wxFolderView.cpp | 16 +-
src/gui/wxOptionsDlg.cpp | 17 --
10 files changed, 32 insertions(+), 1084 deletions(-)
delete mode 100644 src/Python/PythonDll.cpp
hooks/post-receive
--
Mahogany sources repository.
--===============6949208375537460313==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--===============6949208375537460313==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates
--===============6949208375537460313==--