fix for issue raise by patch [#30154] non utf8 buildinfo, fails to import 'bpy' module.

we cant ensure buildinfo to have utf8 encoding so access it as bytes via python - a different workaround then this patch made.

also use C style string formatting for sys_info.py
This commit is contained in:
2012-03-04 03:14:38 +00:00
parent 6c37e0a442
commit 4f2976941f
2 changed files with 58 additions and 54 deletions

View File

@@ -108,6 +108,8 @@ static PyObject *make_app_info(void)
PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag))
#define SetStrItem(str) \
PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str))
#define SetBytesItem(str) \
PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str))
#define SetObjItem(obj) \
PyStructSequence_SET_ITEM(app_info, pos++, obj)
@@ -121,27 +123,28 @@ static PyObject *make_app_info(void)
SetStrItem(BLI_program_path());
SetObjItem(PyBool_FromLong(G.background));
/* build info */
/* build info, use bytes since we can't assume _any_ encoding:
* see patch [#30154] for issue */
#ifdef BUILD_DATE
SetStrItem(build_date);
SetStrItem(build_time);
SetStrItem(build_rev);
SetStrItem(build_platform);
SetStrItem(build_type);
SetStrItem(build_cflags);
SetStrItem(build_cxxflags);
SetStrItem(build_linkflags);
SetStrItem(build_system);
SetBytesItem(build_date);
SetBytesItem(build_time);
SetBytesItem(build_rev);
SetBytesItem(build_platform);
SetBytesItem(build_type);
SetBytesItem(build_cflags);
SetBytesItem(build_cxxflags);
SetBytesItem(build_linkflags);
SetBytesItem(build_system);
#else
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetStrItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
SetBytesItem("Unknown");
#endif
SetObjItem(BPY_app_ffmpeg_struct());
@@ -149,6 +152,7 @@ static PyObject *make_app_info(void)
#undef SetIntItem
#undef SetStrItem
#undef SetBytesItem
#undef SetObjItem
if (PyErr_Occurred()) {