--- a/python/gplugin-python-loader.c Fri Jan 10 23:18:08 2020 -0600
+++ b/python/gplugin-python-loader.c Tue Feb 04 08:21:49 2020 +0000
@@ -311,43 +311,23 @@
gplugin_python_loader_init_python(void) {
- const gchar *program = NULL;
wchar_t *argv[] = { NULL, NULL };
- program = g_get_prgname();
- program = program ? program : "";
- len = mbstowcs(NULL, program, 0);
- if(len == (size_t)-1) {
+ argv[0] = Py_DecodeLocale(g_get_prgname(), NULL); g_warning("Could not convert program name to wchar_t string.");
- argv[0] = g_new(wchar_t, len + 1);
- len = mbstowcs(argv[0], program, len + 1);
- if(len == (size_t)-1) {
- g_warning("Could not convert program name to wchar_t string.");
/* setup sys.path according to
* https://docs.python.org/3/c-api/init.html#PySys_SetArgvEx
-#if PY_VERSION_HEX < 0x03010300
- PySys_SetArgv(1, argv);
- PyRun_SimpleString("import sys; sys.path.pop(0)\n");
PySys_SetArgvEx(1, argv, 0);
+ PyMem_RawFree(argv[0]); /* initialize pygobject */
if(gplugin_python_loader_init_pygobject()) {
--- a/python/meson.build Fri Jan 10 23:18:08 2020 -0600
+++ b/python/meson.build Tue Feb 04 08:21:49 2020 +0000
@@ -16,12 +16,12 @@
'gplugin-python-utils.h',
- PYTHON3 = dependency('python3-embed', required: false)
+ PYTHON3 = dependency('python3-embed', version: '>=3.5.0', required: false) - PYTHON3 = dependency('python3')
+ PYTHON3 = dependency('python3', version: '>=3.5.0') - PYGOBJECT = dependency('pygobject-3.0', version : '>=3.0.0')
+ PYGOBJECT = dependency('pygobject-3.0', version: '>=3.0.0') # Compile and run our python-gi test program
python_gi_test = compiler.run(files('gplugin-python-test-pygobject.c'),
@@ -33,7 +33,7 @@
gplugin_python_inc = include_directories('.')
- gplugin_python = shared_library('gplugin-python',
+ gplugin_python = shared_library('gplugin-python3',