From 12228581337d1c597e3a7d6f6d74baa6e9e809b2 Mon Sep 17 00:00:00 2001 From: Pawel Czarnecki Date: Fri, 16 Jun 2023 11:53:35 +0000 Subject: [PATCH] embedded_python_interpreter: fix python library path Signed-off-by: Pawel Czarnecki --- .../embedded_python_interpreter/print_libpython_path.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dependency_support/embedded_python_interpreter/print_libpython_path.py b/dependency_support/embedded_python_interpreter/print_libpython_path.py index 2e584e89c0..b6eec1a12e 100644 --- a/dependency_support/embedded_python_interpreter/print_libpython_path.py +++ b/dependency_support/embedded_python_interpreter/print_libpython_path.py @@ -23,4 +23,13 @@ for pv in ('LIBDIR', 'LIBPL') ] +if 'rules_hdl_cpython' in config_vars['prefix']: + # Hack: Work around broken library paths in the hermetic Python toolchain. + # It reports that the library path is an absolute path like + # + # /install/lib/libpython3.8.so + # + # This path doesn't exist. So we'll fix it here. + file_paths = [path.replace('/install', config_vars['prefix']) for path in file_paths] + print(list(filter(os.path.exists, file_paths))[0])