X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=srd.c;h=35ec5f2e9b7761f8847d957affd0935b2ed39677;hp=6bff9188aea68a4466340297d20122fd0973e4fe;hb=HEAD;hpb=ec5fc441e38e59a57cd508abf420e30fc3c28e0d diff --git a/srd.c b/srd.c index 6bff918..10dfaf6 100644 --- a/srd.c +++ b/srd.c @@ -285,9 +285,31 @@ SRD_API int srd_init(const char *path) return ret; } } + env_path = g_getenv("SIGROKDECODE_PATH"); + if (env_path) { + char **dir_list, **dir_iter, *dir_item; + dir_list = g_strsplit(env_path, G_SEARCHPATH_SEPARATOR_S, 0); + for (dir_iter = dir_list; *dir_iter; dir_iter++) { + dir_item = *dir_iter; + if (!dir_item || !*dir_item) + continue; + ret = srd_decoder_searchpath_add(dir_item); + if (ret != SRD_OK) { + Py_Finalize(); + return ret; + } + } + g_strfreev(dir_list); + } - /* Initialize the Python GIL (this also happens to acquire it). */ +#if PY_VERSION_HEX < 0x03090000 + /* + * Initialize and acquire the Python GIL. In Python 3.7+ this + * will be done implicitly as part of the Py_InitializeEx() + * call above. PyEval_InitThreads() was deprecated in 3.9. + */ PyEval_InitThreads(); +#endif /* Release the GIL (ignore return value, we don't need it here). */ (void)PyEval_SaveThread();