Add python_path configuration option.

Allows adding more items to the python path so imports from inside
python scripts work more sensible depending on how you configure your
app.
This commit is contained in:
Joris Vink 2018-03-01 12:55:33 +01:00
parent 823e76f582
commit ff21fd330f
2 changed files with 16 additions and 0 deletions

View File

@ -107,6 +107,7 @@ static int configure_task_threads(char *);
#endif
#if defined(KORE_USE_PYTHON)
static int configure_python_path(char *);
static int configure_python_import(char *);
#endif
@ -121,6 +122,7 @@ static struct {
{ "bind", configure_bind },
{ "load", configure_load },
#if defined(KORE_USE_PYTHON)
{ "python_path", configure_python_path },
{ "python_import", configure_python_import },
#endif
{ "domain", configure_domain },
@ -1137,6 +1139,14 @@ configure_task_threads(char *option)
#endif
#if defined(KORE_USE_PYTHON)
static int
configure_python_path(char *path)
{
kore_python_path(path);
return (KORE_RESULT_OK);
}
static int
configure_python_import(char *module)
{

View File

@ -147,6 +147,12 @@ kore_python_cleanup(void)
}
}
void
kore_python_path(const char *path)
{
python_append_path(path);
}
static void *
python_malloc(void *ctx, size_t len)
{