File blender-2.56-svn35386.patch of Package blender

Index: release/scripts/startup/bl_ui/space_userpref.py
===================================================================
--- release/scripts/startup/bl_ui/space_userpref.py.orig	2011-04-28 19:00:52.000000000 +0200
+++ release/scripts/startup/bl_ui/space_userpref.py	2011-04-28 23:38:45.500747370 +0200
@@ -1096,7 +1096,8 @@ class WM_OT_addon_install(bpy.types.Oper
         addon_path = ""
         pyfile_dir = os.path.dirname(pyfile)
         for addon_path in addon_utils.paths():
-            if os.path.samefile(pyfile_dir, addon_path):
+            # if os.path.samefile(pyfile_dir, addon_path):  # Py3.2 only!, upgrade soon!
+            if (hasattr(os.path, "samefile") and os.path.samefile(pyfile_dir, addon_path)) or pyfile_dir == addon_path:
                 self.report({'ERROR'}, "Source file is in the addon search path: %r" % addon_path)
                 return {'CANCELLED'}
         del addon_path
Index: source/gameengine/GameLogic/SCA_PythonController.cpp
===================================================================
--- source/gameengine/GameLogic/SCA_PythonController.cpp.orig	2011-04-28 19:03:23.000000000 +0200
+++ source/gameengine/GameLogic/SCA_PythonController.cpp	2011-04-28 23:38:45.501747345 +0200
@@ -415,7 +415,11 @@ void SCA_PythonController::Trigger(SCA_L
 
 		excdict= PyDict_Copy(m_pythondictionary);
 
+#if PY_VERSION_HEX >=  0x03020000
 		resultobj = PyEval_EvalCode((PyObject *)m_bytecode, excdict, excdict);
+#else
+		resultobj = PyEval_EvalCode((PyCodeObject *)m_bytecode, excdict, excdict);
+#endif
 
 		/* PyRun_SimpleString(m_scriptText.Ptr()); */
 		break;
Index: source/blender/python/intern/bpy_interface.c
===================================================================
--- source/blender/python/intern/bpy_interface.c.orig	2011-04-28 19:04:29.000000000 +0200
+++ source/blender/python/intern/bpy_interface.c	2011-04-28 23:38:45.546746209 +0200
@@ -318,7 +318,7 @@ static int python_script_exec(bContext *
 
 	if (text) {
 		char fn_dummy[FILE_MAXDIR];
-		bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text);
+		bpy_text_filename_get(fn_dummy, text);
 
 		if(text->compiled == NULL) {	/* if it wasn't already compiled, do it now */
 			char *buf= txt_to_buf(text);
Index: source/blender/python/generic/py_capi_utils.c
===================================================================
--- source/blender/python/generic/py_capi_utils.c.orig	2011-04-28 19:04:33.000000000 +0200
+++ source/blender/python/generic/py_capi_utils.c	2011-04-28 23:38:45.571745571 +0200
@@ -75,6 +75,18 @@ void PyC_LineSpit(void) {
 	fprintf(stderr, "%s:%d\n", filename, lineno);
 }
 
+/* python 3.2 only, copied from frameobjec.c */
+#if PY_VERSION_HEX <  0x03020000
+int
+PyFrame_GetLineNumber(PyFrameObject *f)
+{
+    if (f->f_trace)
+        return f->f_lineno;
+    else
+        return PyCode_Addr2Line(f->f_code, f->f_lasti);
+}
+#endif
+
 void PyC_FileAndNum(const char **filename, int *lineno)
 {
 	PyFrameObject *frame;
Index: source/blender/python/generic/bpy_internal_import.c
===================================================================
--- source/blender/python/generic/bpy_internal_import.c.orig	2011-04-28 19:04:33.000000000 +0200
+++ source/blender/python/generic/bpy_internal_import.c	2011-04-28 23:38:45.596744935 +0200
@@ -95,9 +95,16 @@ void bpy_import_main_set(struct Main *ma
 }
 
 /* returns a dummy filename for a textblock so we can tell what file a text block comes from */
-void bpy_text_filename_get(char *fn, size_t fn_len, Text *text)
+void bpy_text_filename_get(char *fn, Text *text)
 {
-	BLI_snprintf(fn, fn_len, "%s%c%s", text->id.lib ? text->id.lib->filepath : G.main->name, SEP, text->id.name+2);
+#if PY_VERSION_HEX >=  0x03020000
+	sprintf(fn, "%s%c%s", text->id.lib ? text->id.lib->filepath : G.main->name, SEP, text->id.name+2);
+#else
+	/* this is a bug in python's Py_CompileString()!, fixed for python 3.2.
+	 the string encoding should not be required to be utf-8
+	 reported: http://bugs.python.org/msg115202  */
+	strcpy(fn, text->id.name+2);
+#endif
 }
 
 PyObject *bpy_text_import(Text *text)
@@ -108,7 +115,7 @@ PyObject *bpy_text_import(Text *text)
 
 	if(!text->compiled) {
 		char fn_dummy[256];
-		bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text);
+		bpy_text_filename_get(fn_dummy, text);
 
 		buf= txt_to_buf(text);
 		text->compiled= Py_CompileString(buf, fn_dummy, Py_file_input);
Index: source/blender/python/generic/bpy_internal_import.h
===================================================================
--- source/blender/python/generic/bpy_internal_import.h.orig	2011-04-28 19:04:33.000000000 +0200
+++ source/blender/python/generic/bpy_internal_import.h	2011-04-28 23:38:45.621744303 +0200
@@ -54,7 +54,7 @@ PyObject*	bpy_text_import_name(char *nam
 PyObject*	bpy_text_reimport(PyObject *module, int *found);
 /* void		bpy_text_clear_modules(int clear_all);*/ /* Clear user modules */ 
 
-void bpy_text_filename_get(char *fn, size_t fn_len, struct Text *text);
+void bpy_text_filename_get(char *fn, struct Text *text);
 
 extern PyMethodDef bpy_import_meth;
 extern PyMethodDef bpy_reload_meth;
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt.orig	2011-04-28 19:11:55.000000000 +0200
+++ CMakeLists.txt	2011-04-28 23:38:45.647743643 +0200
@@ -840,7 +840,7 @@ elseif(APPLE)
 	set(PYTHON_VERSION 3.2)
 
 	if(PYTHON_VERSION MATCHES 3.2)
-		# we use precompiled libraries for py 3.2 and up by default
+		# we use precompiled libraries for py 3.1 and up by default
 
 		set(PYTHON ${LIBDIR}/python)
 		set(PYTHON_INCLUDE_DIRS "${PYTHON}/include/python${PYTHON_VERSION}")
@@ -852,7 +852,7 @@ elseif(APPLE)
 		# otherwise, use custom system framework
 
 		set(PYTHON /System/Library/Frameworks/Python.framework/Versions/)
-		set(PYTHON_VERSION 3.2)
+		set(PYTHON_VERSION 3.1)
 		set(PYTHON_INCLUDE_DIRS "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}")
 		# set(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION}) # not used yet
 		set(PYTHON_LIBRARY "")
Index: source/blender/python/intern/bpy_util.h
===================================================================
--- source/blender/python/intern/bpy_util.h.orig	2011-04-28 19:04:29.000000000 +0200
+++ source/blender/python/intern/bpy_util.h	2011-04-28 23:38:45.672743011 +0200
@@ -30,8 +30,8 @@
 #ifndef BPY_UTIL_H
 #define BPY_UTIL_H
 
-#if PY_VERSION_HEX <  0x03020000
-#error "Python 3.2 or greater is required, you'll need to update your python."
+#if PY_VERSION_HEX <  0x03010000
+#error "Python 3.1 or greater is required, you'll need to update your python."
 #endif
 
 #include "RNA_types.h" /* for EnumPropertyItem only */
openSUSE Build Service is sponsored by