diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-05-06 22:35:13 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-05-07 14:00:15 +0200 |
commit | c5a0f829fcce841ed53e13218a6274ea1da9c678 (patch) | |
tree | 0626f8280011e41cd4b161a901f0a9d74feb4558 /sources | |
parent | 0117bd14cb2a58fec09d5d08fd1835a041f929ce (diff) |
Fix Designer plugin to load on Linux
Preload a python library to provide the Python symbols.
Pick-to: 6.1 6.1.0
Task-number: PYSIDE-1455
Change-Id: I8d84bd6f3129c500471653b54e415882d5c0bde1
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources')
-rw-r--r-- | sources/pyside-tools/pyside_tool.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sources/pyside-tools/pyside_tool.py b/sources/pyside-tools/pyside_tool.py index d4f283bfc..da29025c8 100644 --- a/sources/pyside-tools/pyside_tool.py +++ b/sources/pyside-tools/pyside_tool.py @@ -94,6 +94,19 @@ def designer(): # PySide6/scripts. pyside_dir = Path(__file__).resolve().parents[1] + # https://www.python.org/dev/peps/pep-0384/#linkage : + # "On Unix systems, the ABI is typically provided by the python executable + # itself", that is, libshiboken does not link against any Python library + # and expects to get these symbols from a python executable. Since no + # python executable is involved when loading this plugin, pre-load python.so + # This should also help to work around a numpy issue, see + # https://stackoverflow.com/questions/49784583/numpy-import-fails-on-multiarray-extension-library-when-called-from-embedded-pyt + if sys.platform == 'linux': + # Determine library name (examples/utils/pyside_config.py) + version = f'{sys.version_info[0]}.{sys.version_info[1]}' + library_name = f'libpython{version}{sys.abiflags}.so' + os.environ['LD_PRELOAD'] = library_name + # Add the Wiggly Widget example wiggly_dir = os.fspath(pyside_dir / 'examples' / 'widgetbinding') _append_to_path_var('PYSIDE_DESIGNER_PLUGINS', wiggly_dir) |