Document libbabeltrace2's C API
[babeltrace.git] / src / python-plugin-provider / python-plugin-provider.c
index 43a4cf04250a5c2139b27696665b0604c5585204..5d8d8b65455aba53d35f69241cdf8185f8bacbf8 100644 (file)
  */
 
 #define BT_LOG_TAG "LIB/PLUGIN-PY"
-
 #include "lib/logging.h"
+
+#include "python-plugin-provider.h"
+
 #include "common/macros.h"
 #include "compat/compiler.h"
-#include <babeltrace2/plugin/plugin-const.h>
+#include <babeltrace2/plugin/plugin-loading.h>
 #include "lib/plugin/plugin.h"
 #include <babeltrace2/graph/component-class.h>
-#include <babeltrace2/current-thread.h>
+#include <babeltrace2/error-reporting.h>
 #include "lib/graph/component-class.h"
 #include "py-common/py-common.h"
+#include <stdbool.h>
 #include <stdlib.h>
 #include <signal.h>
 #include <Python.h>
@@ -46,7 +49,7 @@
 #define PYTHON_PLUGIN_FILE_EXT         ".py"
 #define PYTHON_PLUGIN_FILE_EXT_LEN     (sizeof(PYTHON_PLUGIN_FILE_EXT) - 1)
 
-enum python_state {
+static enum python_state {
        /* init_python() not called yet */
        PYTHON_STATE_NOT_INITED,
 
@@ -79,7 +82,7 @@ void append_python_traceback_error_cause(void)
                }
 
                (void) BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(
-                       "Babeltrace library", "%s", exc->str);
+                       BT_LIB_LOG_LIBBABELTRACE2_NAME, "%s", exc->str);
        }
 
 end:
@@ -140,17 +143,19 @@ int init_python(void)
                ret = BT_FUNC_STATUS_ERROR;
                goto end;
        default:
-               abort();
+               bt_common_abort();
        }
 
        /*
         * User can disable Python plugin support with the
-        * BABELTRACE_DISABLE_PYTHON_PLUGINS environment variable set to
-        * 1.
+        * `LIBBABELTRACE2_DISABLE_PYTHON_PLUGINS` environment variable
+        * set to 1.
         */
-       dis_python_env = getenv("BABELTRACE_DISABLE_PYTHON_PLUGINS");
+       dis_python_env = getenv("LIBBABELTRACE2_DISABLE_PYTHON_PLUGINS");
        if (dis_python_env && strcmp(dis_python_env, "1") == 0) {
-               BT_LOGI_STR("Python plugin support is disabled because `BABELTRACE_DISABLE_PYTHON_PLUGINS=1`.");
+               BT_LOGI_STR("Python plugin support is disabled because the "
+                       "`LIBBABELTRACE2_DISABLE_PYTHON_PLUGINS` environment "
+                       "variable is set to `1`.");
                python_state = PYTHON_STATE_WONT_INITIALIZE;
                ret = BT_FUNC_STATUS_NOT_FOUND;
                goto end;
@@ -637,7 +642,9 @@ int bt_plugin_python_create_all_from_file(const char *path,
                 * Python plugins are disabled, so it's simply not
                 * found.
                 */
-               BT_LOGI_STR("Python plugin support was disabled previously because `BABELTRACE_DISABLE_PYTHON_PLUGINS=1`.");
+               BT_LOGI_STR("Python plugin support was disabled previously "
+                       "because the `LIBBABELTRACE2_DISABLE_PYTHON_PLUGINS` "
+                       "environment variable is set to `1`.");
                status = BT_FUNC_STATUS_NOT_FOUND;
                goto error;
        }
This page took 0.02671 seconds and 4 git commands to generate.