davemds pushed a commit to branch master.

http://git.enlightenment.org/enlightenment/modules/edgar.git/commit/?id=26a99ee82e8a271e1ae37b3eb863d53eb241ab0d

commit 26a99ee82e8a271e1ae37b3eb863d53eb241ab0d
Author: Dave Andreoli <[email protected]>
Date:   Sun Apr 26 09:01:17 2020 +0200

    A much better way to find the libpython soname
    
    This should work 100% of the time, since py 3.2, and without
    any fuzzy searching
---
 meson.build       | 6 ++++++
 src/e_mod_edgar.c | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index cbfc1d3..36321a1 100644
--- a/meson.build
+++ b/meson.build
@@ -20,9 +20,14 @@ e_module_arch = dep_e.get_pkgconfig_variable('module_arch')
 #### Python3 ####
 py3 = import('python').find_installation('python3', modules: ['efl', 'dbus'])
 dep_py3 = py3.dependency(embed: true)
+
+## bytecompile command to be used by gadgets
 py3_bytecompile = [py3, meson.source_root() / 'meson_bytecompile.py',
                    '@INPUT@', '@OUTPUT@']
 
+## find the installed libpython soname, will be dlopened at runtime
+py_instsoname = py3.get_variable('INSTSONAME')
+
 
 #### Install dirs ####
 mod_install_dir = join_paths(e_modules_dir, meson.project_name())
@@ -33,6 +38,7 @@ gadgets_install_dir = join_paths(e_lib_dir, 'enlightenment', 
'edgar_gadgets')
 #### Config.h ####
 config_h = configuration_data()
 config_h.set_quoted('PACKAGE', meson.project_name())
+config_h.set_quoted('PYINSTSONAME', py_instsoname)
 config_dir = include_directories('.')
 
 
diff --git a/src/e_mod_edgar.c b/src/e_mod_edgar.c
index 09aa3fe..b0f4fc7 100644
--- a/src/e_mod_edgar.c
+++ b/src/e_mod_edgar.c
@@ -20,6 +20,7 @@
 #include <e.h>
 #include <Efl_Ui.h>
 
+#include "edgar_config.h"
 #include "e_mod_main.h"
 #include "e_mod_edgar.h"
 #include "efl.eo_api.h"
@@ -151,10 +152,10 @@ edgar_init()
 
    // 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));
+   // NOTE: PYINSTSONAME is gathered at build time from the sysconfig module
+   py3_lib_handle = dlopen(PYINSTSONAME, (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>"

-- 


Reply via email to