[Bf-blender-cvs] [a1f46ac9dc7] master: Revert "PyAPI: remove bpy.app.binary_path_python"

Campbell Barton noreply at git.blender.org
Sun Nov 1 09:11:37 CET 2020


Commit: a1f46ac9dc71d66adced895a98f912a5d8440748
Author: Campbell Barton
Date:   Sun Nov 1 18:26:11 2020 +1100
Branches: master
https://developer.blender.org/rBa1f46ac9dc71d66adced895a98f912a5d8440748

Revert "PyAPI: remove bpy.app.binary_path_python"

This reverts commit 6527a14cd2ceaaf529beae522ca594bb250b56c9.

Some 3rd party scripts made use of this so scripts can work with
2.90 to 2.92, although eventually this can still be removed.

===================================================================

M	source/blender/python/intern/bpy_app.c

===================================================================

diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 4b182bf1aa5..02ab001dbf6 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -295,6 +295,15 @@ static int bpy_app_global_flag_set__only_disable(PyObject *UNUSED(self),
   return bpy_app_global_flag_set(NULL, value, closure);
 }
 
+PyDoc_STRVAR(bpy_app_binary_path_python_doc,
+             "String, the path to the python executable (read-only). "
+             "Deprecated! Use ``sys.executable`` instead.");
+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'!");
+  return Py_INCREF_RET(PySys_GetObject("executable"));
+}
+
 PyDoc_STRVAR(bpy_app_debug_value_doc,
              "Short, number which can be set to non-zero values for testing purposes");
 static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(closure))
@@ -434,6 +443,12 @@ static PyGetSetDef bpy_app_getsets[] = {
      bpy_app_global_flag_doc,
      (void *)G_FLAG_USERPREF_NO_SAVE_ON_EXIT},
 
+    {"binary_path_python",
+     bpy_app_binary_path_python_get,
+     NULL,
+     bpy_app_binary_path_python_doc,
+     NULL},
+
     {"debug_value",
      bpy_app_debug_value_get,
      bpy_app_debug_value_set,



More information about the Bf-blender-cvs mailing list