Skip to content
Snippets Groups Projects
Commit 12879457 authored by Vincent Delbar's avatar Vincent Delbar
Browse files

FIX: try symlink python libs for executable in /usr/local/bin

parent 87de0932
No related branches found
No related tags found
2 merge requests!108Release 2.0.0,!98Add function for interactive OTB installation
Pipeline #13787 passed
# -*- 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
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment