mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Execute python string to append plugin path
This commit is contained in:
parent
eeb0f71cbf
commit
8ff9fd7091
@ -62,27 +62,17 @@ python_env_init(void)
|
|||||||
Py_Initialize();
|
Py_Initialize();
|
||||||
PyEval_InitThreads();
|
PyEval_InitThreads();
|
||||||
python_api_init();
|
python_api_init();
|
||||||
GString *path = g_string_new(Py_GetPath());
|
|
||||||
|
|
||||||
g_string_append(path, ":");
|
GString *path = g_string_new("import sys\n");
|
||||||
|
g_string_append(path, "sys.path.append(\"");
|
||||||
gchar *plugins_dir = plugins_get_dir();
|
gchar *plugins_dir = plugins_get_dir();
|
||||||
g_string_append(path, plugins_dir);
|
g_string_append(path, plugins_dir);
|
||||||
g_string_append(path, "/");
|
|
||||||
g_free(plugins_dir);
|
g_free(plugins_dir);
|
||||||
|
g_string_append(path, "/\")\n");
|
||||||
|
|
||||||
|
PyRun_SimpleString(path->str);
|
||||||
|
|
||||||
PySys_SetPath(path->str);
|
|
||||||
g_string_free(path, TRUE);
|
g_string_free(path, TRUE);
|
||||||
|
|
||||||
// add site packages paths
|
|
||||||
PyRun_SimpleString(
|
|
||||||
"import site\n"
|
|
||||||
"import sys\n"
|
|
||||||
"from distutils.sysconfig import get_python_lib\n"
|
|
||||||
"sys.path.append(get_python_lib())\n"
|
|
||||||
"for dir in site.getsitepackages():\n"
|
|
||||||
" sys.path.append(dir)\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
allow_python_threads();
|
allow_python_threads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user