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
This commit is contained in:
Davide Andreoli 2020-04-26 09:01:17 +02:00
parent 443bf2efbf
commit 26a99ee82e
2 changed files with 9 additions and 2 deletions

View File

@ -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('.')

View File

@ -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>"