Finally make edgar works again with recent E \o/

Many thanks to raster for helping find a solution...and spank him for breaking edgar :D
This commit is contained in:
Davide Andreoli 2020-04-23 07:52:26 +02:00
parent 53bdf254bd
commit e4803fdb3f
4 changed files with 21 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2008-2018 Davide Andreoli (see AUTHORS)
/* Copyright (C) 2008-2020 Davide Andreoli (see AUTHORS)
*
* This file is part of edgar.
* edgar is free software: you can redistribute it and/or modify
@ -82,6 +82,7 @@ PyMODINIT_FUNC PyInit_eapi(void);
/* Local Variables */
static void *py3_lib_handle;
static const char *edgar_gadgets_system_dir; //ex: "/usr/lib/enlightenment/gadgets/"
static Eina_Hash *edgar_gadgets; //key: "gadget_name" val: Edgar_Py_Gadget*
static PyObject *evasObjectType;
@ -148,6 +149,19 @@ edgar_init()
char buf[PATH_MAX];
int ret;
// Make cpython visible to gadgets and to gadgets imported modules
// NOTE: This is needed because e load modules using RTLD_LOCAL
py3_lib_handle = dlopen("libpython3.so", (RTLD_LAZY | RTLD_GLOBAL));
if (!py3_lib_handle)
{
DBG("EDGAR: Cannot find libpython3.so");
e_util_dialog_internal("Edgar Error",
"<font align=left><b>Cannot find Python3 lib.</b><br>"
"Your python gadgets will not work.<br><br>"
"Please make sure Python3 is installed.</font>");
return EINA_FALSE;
}
// prepare the local scope
snprintf(buf, sizeof(buf), "%s/enlightenment/edgar_gadgets", e_prefix_lib_get());
edgar_gadgets_system_dir = eina_stringshare_add(buf);
@ -219,6 +233,9 @@ edgar_shutdown()
// clean local scope
eina_stringshare_del(edgar_gadgets_system_dir);
if (py3_lib_handle)
dlclose(py3_lib_handle);
DBG("EDGAR: Shutdown completed!");
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2008-2018 Davide Andreoli (see AUTHORS)
/* Copyright (C) 2008-2020 Davide Andreoli (see AUTHORS)
*
* This file is part of edgar.
* edgar is free software: you can redistribute it and/or modify

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2008-2018 Davide Andreoli (see AUTHORS)
/* Copyright (C) 2008-2020 Davide Andreoli (see AUTHORS)
*
* This file is part of edgar.
* edgar is free software: you can redistribute it and/or modify

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2008-2018 Davide Andreoli (see AUTHORS)
/* Copyright (C) 2008-2020 Davide Andreoli (see AUTHORS)
*
* This file is part of edgar.
* edgar is free software: you can redistribute it and/or modify