Merged changes in the trunk up to revision 25613.
[blender.git] / source / blender / python / intern / bpy_interface.c
index ac47b37ca7de7e7a3f47842af7971dcfa391a9d9..82d1c0f262a358a49d3af2b6b4e67b0d1d2c8ef3 100644 (file)
@@ -59,6 +59,7 @@
 #include "BLI_fileops.h"
 #include "BLI_string.h"
 
+#include "BKE_blender.h"
 #include "BKE_context.h"
 #include "BKE_text.h"
 #include "BKE_context.h"
@@ -223,6 +224,16 @@ static void bpy_init_modules( void )
                PyModule_AddObject(mod, "context", (PyObject *)bpy_context_module);
        }
 
+       /* blender info that wont change at runtime, add into _bpy */
+       {
+               PyObject *mod_dict= PyModule_GetDict(mod);
+               char tmpstr[256];
+               PyModule_AddStringConstant(mod, "_HOME",  BLI_gethome());
+               PyDict_SetItemString(mod_dict, "_VERSION", Py_BuildValue("(iii)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION));
+               sprintf(tmpstr, "%d.%02d (sub %d)", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
+               PyModule_AddStringConstant(mod, "_VERSION_STR",  tmpstr);
+       }
+
        /* add our own modules dir, this is a python package */
        bpy_import_test("bpy");
 }