Cleanup: use logging for "Found bundled Python" message

This was added when Python was initially bundled so any problems
finding Python could be investigated.

Move this to use logging so we can show this information when needed.
This commit is contained in:
2020-11-02 19:33:32 +11:00
parent 27acf8ced8
commit d49c71e96e
3 changed files with 23 additions and 26 deletions

View File

@@ -80,6 +80,7 @@
/* Logging types to use anywhere in the Python modules. */
CLG_LOGREF_DECLARE_GLOBAL(BPY_LOG_CONTEXT, "bpy.context");
CLG_LOGREF_DECLARE_GLOBAL(BPY_LOG_INTERFACE, "bpy.interface");
CLG_LOGREF_DECLARE_GLOBAL(BPY_LOG_RNA, "bpy.rna");
/* for internal use, when starting and ending python scripts */
@@ -304,7 +305,6 @@ void BPY_python_start(bContext *C, int argc, const char **argv)
{
#ifndef WITH_PYTHON_MODULE
PyThreadState *py_tstate = NULL;
const char *py_path_bundle = BKE_appdir_folder_id(BLENDER_SYSTEM_PYTHON, NULL);
/* Needed for Python's initialization for portable Python installations.
* We could use #Py_SetPath, but this overrides Python's internal logic
@@ -321,8 +321,21 @@ void BPY_python_start(bContext *C, int argc, const char **argv)
/* must run before python initializes */
PyImport_ExtendInittab(bpy_internal_modules);
/* allow to use our own included python */
PyC_SetHomePath(py_path_bundle);
/* Allow to use our own included Python. `py_path_bundle` may be NULL. */
{
const char *py_path_bundle = BKE_appdir_folder_id(BLENDER_SYSTEM_PYTHON, NULL);
if (py_path_bundle != NULL) {
PyC_SetHomePath(py_path_bundle);
}
else {
/* Common enough to use the system Python on Linux/Unix, warn on other systems. */
# if defined(__APPLE__) || defined(_WIN32)
fprintf(stderr,
"Bundled Python not found and is expected on this platform "
"(the 'install' target may have not been built)\n");
# endif
}
}
/* Without this the `sys.stdout` may be set to 'ascii'
* (it is on my system at least), where printing unicode values will raise