Revert "PyAPI: point sys.executable to the Python binary"
This reverts commit 04c5471cee.
This causes Blender not to start on some systems.
This commit is contained in:
@@ -82,10 +82,10 @@ def write_sysinfo(filepath):
|
|||||||
output.write("\t%r\n" % p)
|
output.write("\t%r\n" % p)
|
||||||
|
|
||||||
output.write(title("Python (External Binary)"))
|
output.write(title("Python (External Binary)"))
|
||||||
output.write("binary path: %s\n" % prepr(sys.executable))
|
output.write("binary path: %s\n" % prepr(bpy.app.binary_path_python))
|
||||||
try:
|
try:
|
||||||
py_ver = prepr(subprocess.check_output([
|
py_ver = prepr(subprocess.check_output([
|
||||||
sys.executable,
|
bpy.app.binary_path_python,
|
||||||
"--version",
|
"--version",
|
||||||
]).strip())
|
]).strip())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -292,13 +292,36 @@ static int bpy_app_global_flag_set__only_disable(PyObject *UNUSED(self),
|
|||||||
return bpy_app_global_flag_set(NULL, value, closure);
|
return bpy_app_global_flag_set(NULL, value, closure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define BROKEN_BINARY_PATH_PYTHON_HACK
|
||||||
|
|
||||||
PyDoc_STRVAR(bpy_app_binary_path_python_doc,
|
PyDoc_STRVAR(bpy_app_binary_path_python_doc,
|
||||||
"String, the path to the python executable (read-only). "
|
"String, the path to the python executable (read-only)");
|
||||||
"Deprecated! Use ``sys.executable`` instead.");
|
static PyObject *bpy_app_binary_path_python_get(PyObject *self, void *UNUSED(closure))
|
||||||
static PyObject *bpy_app_binary_path_python_get(PyObject *UNUSED(self), void *UNUSED(closure))
|
|
||||||
{
|
{
|
||||||
PyErr_Warn(PyExc_RuntimeWarning, "Use 'sys.executable' instead of 'binary_path_python'!");
|
/* refcount is held in BlenderAppType.tp_dict */
|
||||||
return Py_INCREF_RET(PySys_GetObject("executable"));
|
static PyObject *ret = NULL;
|
||||||
|
|
||||||
|
if (ret == NULL) {
|
||||||
|
/* only run once */
|
||||||
|
char fullpath[1024];
|
||||||
|
BKE_appdir_program_python_search(
|
||||||
|
fullpath, sizeof(fullpath), PY_MAJOR_VERSION, PY_MINOR_VERSION);
|
||||||
|
ret = PyC_UnicodeFromByte(fullpath);
|
||||||
|
#ifdef BROKEN_BINARY_PATH_PYTHON_HACK
|
||||||
|
Py_INCREF(ret);
|
||||||
|
UNUSED_VARS(self);
|
||||||
|
#else
|
||||||
|
PyDict_SetItem(
|
||||||
|
BlenderAppType.tp_dict,
|
||||||
|
/* XXX BAAAADDDDDD! self is not a PyDescr at all! it's bpy.app!!! */ PyDescr_NAME(self),
|
||||||
|
ret);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Py_INCREF(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(bpy_app_debug_value_doc,
|
PyDoc_STRVAR(bpy_app_debug_value_doc,
|
||||||
|
|||||||
@@ -306,23 +306,13 @@ void BPY_python_start(bContext *C, int argc, const char **argv)
|
|||||||
PyThreadState *py_tstate = NULL;
|
PyThreadState *py_tstate = NULL;
|
||||||
const char *py_path_bundle = BKE_appdir_folder_id(BLENDER_SYSTEM_PYTHON, NULL);
|
const char *py_path_bundle = BKE_appdir_folder_id(BLENDER_SYSTEM_PYTHON, NULL);
|
||||||
|
|
||||||
/* Setting the program name is important so the 'multiprocessing' module
|
/* Not essential but nice to set our name. */
|
||||||
* can launch new Python instances. */
|
|
||||||
{
|
{
|
||||||
char program_path[FILE_MAX];
|
const char *program_path = BKE_appdir_program_path();
|
||||||
if (BKE_appdir_program_python_search(
|
|
||||||
program_path, sizeof(program_path), PY_MAJOR_VERSION, PY_MINOR_VERSION)) {
|
|
||||||
wchar_t program_path_wchar[FILE_MAX];
|
wchar_t program_path_wchar[FILE_MAX];
|
||||||
BLI_strncpy_wchar_from_utf8(
|
BLI_strncpy_wchar_from_utf8(program_path_wchar, program_path, ARRAY_SIZE(program_path_wchar));
|
||||||
program_path_wchar, program_path, ARRAY_SIZE(program_path_wchar));
|
|
||||||
Py_SetProgramName(program_path_wchar);
|
Py_SetProgramName(program_path_wchar);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
fprintf(stderr,
|
|
||||||
"Unable to find the python binary, "
|
|
||||||
"the multiprocessing module may not be functional!\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* must run before python initializes */
|
/* must run before python initializes */
|
||||||
PyImport_ExtendInittab(bpy_internal_modules);
|
PyImport_ExtendInittab(bpy_internal_modules);
|
||||||
|
|||||||
Reference in New Issue
Block a user