summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorbartus2020-02-06 19:10:48 +0100
committerbartus2020-02-06 19:10:48 +0100
commit2e1b02c9baa5372d6f494e46343bcd4127983866 (patch)
tree346d23bd93e66453c623f4384f1a54639e8deb7e
parent5339ab3e71282bb84b2454e50d3c548a750b084b (diff)
downloadaur-2e1b02c9baa5372d6f494e46343bcd4127983866.tar.gz
Python 3.8 compatibility.
-rw-r--r--.SRCINFO4
-rw-r--r--Cleanup-use-PyImport_GetModuleDict.patch131
-rw-r--r--PKGBUILD8
-rw-r--r--python3.8.patch73
4 files changed, 215 insertions, 1 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 9e7e9f0c77ff..41bd44f40184 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -51,6 +51,8 @@ pkgbase = blender-fracture_modifier-git
source = openvdb.patch
source = collada1668.patch
source = oiio-2.0.patch
+ source = Cleanup-use-PyImport_GetModuleDict.patch
+ source = python3.8.patch
md5sums = SKIP
md5sums = SKIP
md5sums = SKIP
@@ -65,6 +67,8 @@ pkgbase = blender-fracture_modifier-git
md5sums = fe709e616e52c1acc47c1cc0f77c2694
md5sums = 4e4423315f07bc724c7703c57c4481d7
md5sums = f98eb0576a8e00444cc3e936d31a9812
+ md5sums = 1fafe7b27c376f0fd8b7bb7985deef6e
+ md5sums = 54caa2acab217f8abb9a00ef05f1d0d7
pkgname = blender-fracture_modifier-git
diff --git a/Cleanup-use-PyImport_GetModuleDict.patch b/Cleanup-use-PyImport_GetModuleDict.patch
new file mode 100644
index 000000000000..3a4bee890eb6
--- /dev/null
+++ b/Cleanup-use-PyImport_GetModuleDict.patch
@@ -0,0 +1,131 @@
+From 44f719b63238503ef8f933f55383c6d4798995cc Mon Sep 17 00:00:00 2001
+From: Campbell Barton <ideasman42@gmail.com>
+Date: Thu, 13 Sep 2018 17:06:07 +1000
+Subject: [PATCH] Cleanup: use PyImport_GetModuleDict
+
+Replace direct access using PyThreadState_GET
+---
+ source/blender/python/bmesh/bmesh_py_api.c | 2 +-
+ source/blender/python/generic/idprop_py_api.c | 2 +-
+ source/blender/python/intern/bpy_interface.c | 2 +-
+ source/blender/python/intern/gpu.c | 4 ++--
+ source/blender/python/mathutils/mathutils.c | 2 +-
+ source/blender/python/mathutils/mathutils_noise.c | 5 +++--
+ source/gameengine/Ketsji/KX_PythonInit.cpp | 2 +-
+ 7 files changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c
+index d5973baeadb..d7324eabb6c 100644
+--- a/source/blender/python/bmesh/bmesh_py_api.c
++++ b/source/blender/python/bmesh/bmesh_py_api.c
+@@ -196,7 +196,7 @@ PyObject *BPyInit_bmesh(void)
+ {
+ PyObject *mod;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ BPy_BM_init_types();
+ BPy_BM_init_types_select();
+diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
+index 4d4d5232800..8bed0f28cba 100644
+--- a/source/blender/python/generic/idprop_py_api.c
++++ b/source/blender/python/generic/idprop_py_api.c
+@@ -1795,7 +1795,7 @@ PyObject *BPyInit_idprop(void)
+ {
+ PyObject *mod;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ mod = PyModule_Create(&IDProp_module_def);
+
+diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
+index 7ca087e4993..123c938b921 100644
+--- a/source/blender/python/intern/bpy_interface.c
++++ b/source/blender/python/intern/bpy_interface.c
+@@ -537,7 +537,7 @@ static bool python_script_exec(
+
+ if (py_dict) {
+ #ifdef PYMODULE_CLEAR_WORKAROUND
+- PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyThreadState_GET()->interp->modules, "__main__");
++ PyModuleObject *mmod = (PyModuleObject *)PyDict_GetItemString(PyImport_GetModuleDict(), "__main__");
+ PyObject *dict_back = mmod->md_dict;
+ /* freeing the module will clear the namespace,
+ * gives problems running classes defined in this namespace being used later. */
+diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
+index 43796dc9474..d902b6838f4 100644
+--- a/source/blender/python/intern/gpu.c
++++ b/source/blender/python/intern/gpu.c
+@@ -326,7 +326,7 @@ PyObject *GPU_initPython(void)
+ {
+ PyObject *module;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ module = PyInit_gpu();
+
+@@ -337,6 +337,6 @@ PyObject *GPU_initPython(void)
+ PyDict_SetItem(sys_modules, PyModule_GetNameObject(submodule), submodule);
+ Py_INCREF(submodule);
+
+- PyDict_SetItem(PyImport_GetModuleDict(), PyModule_GetNameObject(module), module);
++ PyDict_SetItem(sys_modules, PyModule_GetNameObject(module), module);
+ return module;
+ }
+diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
+index a3a4e7f313b..f021d456b3a 100644
+--- a/source/blender/python/mathutils/mathutils.c
++++ b/source/blender/python/mathutils/mathutils.c
+@@ -615,7 +615,7 @@ PyMODINIT_FUNC PyInit_mathutils(void)
+ {
+ PyObject *mod;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+
+ if (PyType_Ready(&vector_Type) < 0)
+ return NULL;
+diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
+index 839d1ffc588..834322c0aed 100644
+--- a/source/blender/python/mathutils/mathutils_noise.c
++++ b/source/blender/python/mathutils/mathutils_noise.c
+@@ -845,6 +845,7 @@ static struct PyModuleDef M_Noise_module_def = {
+ /*----------------------------MODULE INIT-------------------------*/
+ PyMODINIT_FUNC PyInit_mathutils_noise(void)
+ {
++ PyObject *sys_modules = PyImport_GetModuleDict();
+ PyObject *submodule = PyModule_Create(&M_Noise_module_def);
+ PyObject *item_types, *item_metrics;
+
+@@ -852,11 +853,11 @@ PyMODINIT_FUNC PyInit_mathutils_noise(void)
+ setRndSeed(0);
+
+ PyModule_AddObject(submodule, "types", (item_types = PyInit_mathutils_noise_types()));
+- PyDict_SetItemString(PyThreadState_GET()->interp->modules, "noise.types", item_types);
++ PyDict_SetItemString(sys_modules, "noise.types", item_types);
+ Py_INCREF(item_types);
+
+ PyModule_AddObject(submodule, "distance_metrics", (item_metrics = PyInit_mathutils_noise_metrics()));
+- PyDict_SetItemString(PyThreadState_GET()->interp->modules, "noise.distance_metrics", item_metrics);
++ PyDict_SetItemString(sys_modules, "noise.distance_metrics", item_metrics);
+ Py_INCREF(item_metrics);
+
+ return submodule;
+diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
+index 251273cf7a8..9611a4ea49b 100644
+--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
++++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
+@@ -2234,7 +2234,7 @@ PyMODINIT_FUNC initBGE(void)
+ {
+ PyObject *mod;
+ PyObject *submodule;
+- PyObject *sys_modules = PyThreadState_GET()->interp->modules;
++ PyObject *sys_modules = PyImport_GetModuleDict();
+ const char *mod_full;
+
+ mod = PyModule_Create(&BGE_module_def);
+--
+2.25.0
+
diff --git a/PKGBUILD b/PKGBUILD
index d18d75c56335..51091c338c74 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -47,6 +47,8 @@ source=("git://git.blender.org/blender.git${_fragment}"
openvdb.patch
collada1668.patch
oiio-2.0.patch
+ Cleanup-use-PyImport_GetModuleDict.patch
+ python3.8.patch
)
md5sums=('SKIP'
'SKIP'
@@ -61,7 +63,9 @@ md5sums=('SKIP'
'bb325c8c879d677ad1f1c54797268716'
'fe709e616e52c1acc47c1cc0f77c2694'
'4e4423315f07bc724c7703c57c4481d7'
- 'f98eb0576a8e00444cc3e936d31a9812')
+ 'f98eb0576a8e00444cc3e936d31a9812'
+ '1fafe7b27c376f0fd8b7bb7985deef6e'
+ '54caa2acab217f8abb9a00ef05f1d0d7')
pkgver() {
cd "$srcdir/blender"
@@ -81,6 +85,8 @@ prepare() {
git apply -v ${srcdir}/collada1668.patch
git apply -v ${srcdir}/gcc9.patch
git apply -v ${srcdir}/oiio-2.0.patch
+ git apply -v ${srcdir}/Cleanup-use-PyImport_GetModuleDict.patch
+ git apply -v ${srcdir}/python3.8.patch
msg "change BLENDER_VERSION to ${_blenver/./}"
sed -i "/#define BLENDER_VERSION */s/279/${_blenver/./}/" source/blender/blenkernel/BKE_blender_version.h
}
diff --git a/python3.8.patch b/python3.8.patch
new file mode 100644
index 000000000000..ffaa3e2a914b
--- /dev/null
+++ b/python3.8.patch
@@ -0,0 +1,73 @@
+From 4b663ecf264020b1d7003a137ce84b06d7ec4ce6 Mon Sep 17 00:00:00 2001
+From: bartus <szczepaniak.bartek+github@gmail.com>
+Date: Sat, 16 Nov 2019 20:29:30 +0100
+Subject: [PATCH] Add python 3.8 support.
+
+---
+ source/blender/python/generic/py_capi_utils.c | 27 +++++++++++++++----
+ 1 file changed, 22 insertions(+), 5 deletions(-)
+
+diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
+index 545e0506f84..a7eab70600b 100644
+--- a/source/blender/python/generic/py_capi_utils.c
++++ b/source/blender/python/generic/py_capi_utils.c
+@@ -696,9 +696,16 @@ PyObject *PyC_UnicodeFromByte(const char *str)
+ ****************************************************************************/
+ PyObject *PyC_DefaultNameSpace(const char *filename)
+ {
++ #if PY_VERSION_HEX >= 0x03080000
++ PyObject *modules = PyImport_GetModuleDict();
++ PyObject *builtins = PyEval_GetBuiltins();
++ #else
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
++ PyObject *modules = interp->modules;
++ PyObject *builtins = interp->builtins;
++ #endif
+ PyObject *mod_main = PyModule_New("__main__");
+- PyDict_SetItemString(interp->modules, "__main__", mod_main);
++ PyDict_SetItemString(modules, "__main__", mod_main);
+ Py_DECREF(mod_main); /* sys.modules owns now */
+ PyModule_AddStringConstant(mod_main, "__name__", "__main__");
+ if (filename) {
+@@ -706,8 +713,8 @@ PyObject *PyC_DefaultNameSpace(const char *filename)
+ * note: this wont map to a real file when executing text-blocks and buttons. */
+ PyModule_AddObject(mod_main, "__file__", PyC_UnicodeFromByte(filename));
+ }
+- PyModule_AddObject(mod_main, "__builtins__", interp->builtins);
+- Py_INCREF(interp->builtins); /* AddObject steals a reference */
++ PyModule_AddObject(mod_main, "__builtins__", builtins);
++ Py_INCREF(builtins); /* AddObject steals a reference */
+ return PyModule_GetDict(mod_main);
+ }
+
+@@ -734,15 +741,25 @@ bool PyC_NameSpace_ImportArray(PyObject *py_dict, const char *imports[])
+ /* restore MUST be called after this */
+ void PyC_MainModule_Backup(PyObject **main_mod)
+ {
++ #if PY_VERSION_HEX >= 0x03080000
++ PyObject *modules = PyImport_GetModuleDict();
++ #else
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
+- *main_mod = PyDict_GetItemString(interp->modules, "__main__");
++ PyObject *modules = interp->modules;
++ #endif
++ *main_mod = PyDict_GetItemString(modules, "__main__");
+ Py_XINCREF(*main_mod); /* don't free */
+ }
+
+ void PyC_MainModule_Restore(PyObject *main_mod)
+ {
++ #if PY_VERSION_HEX >= 0x03080000
++ PyObject *modules = PyImport_GetModuleDict();
++ #else
+ PyInterpreterState *interp = PyThreadState_GET()->interp;
+- PyDict_SetItemString(interp->modules, "__main__", main_mod);
++ PyObject *modules = interp->modules;
++ #endif
++ PyDict_SetItemString(modules, "__main__", main_mod);
+ Py_XDECREF(main_mod);
+ }
+
+--
+2.24.0
+