obs-scripting: Add support for multiple Python 3 versions
This changes the way obs-scripting looks for and loads an available Python 3 library. It tries to find a best possible version (starting with Python 3.10) down to and including Python 3.6 by existing file naming conventions and loads the most recent variant it can find. User specified search path is either a Python installation directory (Windows), or a Framework directory containing `Python.framework` (macOS). The dll or dylib names are composed automatically. The Python home path is also composed automatically on macOS (where it has to point inside the Framework directory).
This commit is contained in:
parent
47b3ff5e64
commit
ab21c7e5b0
3 changed files with 59 additions and 18 deletions
10
deps/obs-scripting/obs-scripting-python-import.h
vendored
10
deps/obs-scripting/obs-scripting-python-import.h
vendored
|
|
@ -44,7 +44,6 @@
|
|||
#endif
|
||||
|
||||
#if RUNTIME_LINK
|
||||
|
||||
#ifdef NO_REDEFS
|
||||
#define PY_EXTERN
|
||||
#else
|
||||
|
|
@ -262,7 +261,7 @@ static inline void Import__Py_XDECREF(PyObject *op)
|
|||
|
||||
#undef Py_XDECREF
|
||||
#define Py_XDECREF(op) Import__Py_XDECREF(_PyObject_CAST(op))
|
||||
#endif
|
||||
#endif // PY_VERSION_HEX >= 0x030800f0
|
||||
|
||||
#if PY_VERSION_HEX >= 0x030900b0
|
||||
static inline int Import_PyType_HasFeature(PyTypeObject *type,
|
||||
|
|
@ -271,8 +270,7 @@ static inline int Import_PyType_HasFeature(PyTypeObject *type,
|
|||
return ((PyType_GetFlags(type) & feature) != 0);
|
||||
}
|
||||
#define PyType_HasFeature(t, f) Import_PyType_HasFeature(t, f)
|
||||
#endif
|
||||
#endif // PY_VERSION_HEX >= 0x030900b0
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // NO_REDEFS
|
||||
#endif // RUNTIME_LINK
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue