diff --git a/pyotb/__init__.py b/pyotb/__init__.py index c134e583a89dec72cec8b0f00bfad95fa1fc2864..aff3736392ba7e0d464110dccbba05063b854b38 100644 --- a/pyotb/__init__.py +++ b/pyotb/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """This module provides convenient python wrapping of otbApplications.""" -__version__ = "2.0.0.dev5" +__version__ = "2.0.0.dev6" from .install import install_otb from .helpers import logger, set_logger_level diff --git a/pyotb/install.py b/pyotb/install.py index 76919e2f42b23f971279a2f5ad0d590e5cc1baed..07922c15705f030a0248935fb86e4f900f3bd3e8 100644 --- a/pyotb/install.py +++ b/pyotb/install.py @@ -177,10 +177,15 @@ def install_otb(version: str = "latest", path: str = "", edit_env: bool = True): ) # TODO: support for sudo auto build deps install using apt, pacman/yay, brew... # Else use dirty cross version python symlink (only tested on Ubuntu) - if sys.executable.startswith("/usr/bin"): - lib = f"/usr/lib/x86_64-linux-gnu/libpython3.{sys.version_info.minor}.so" + suffix = "so.1.0" if otb_major >= 8 else f"so.rh-python3{expected}-1.0" + target_lib = f"{path}/lib/libpython3.{expected}.{suffix}" + for prefix in ("/usr", "/usr/local"): + if not sys.executable.startswith(f"{prefix}/bin"): + continue + lib_dir = f"{prefix}/lib" + ("/x86_64-linux-gnu" if prefix == "/usr" else "") + lib = f"{lib_dir}/libpython3.{sys.version_info.minor}.so" if Path(lib).exists(): - print(f"##### Creating symbolic links: {lib} -> {target_lib}") + print(f"##### Creating symbolic link: {lib} -> {target_lib}") ln_cmd = f'ln -sf "{lib}" "{target_lib}"' subprocess.run(ln_cmd, executable=cmd, shell=True, check=True) return str(path)