Skip to content

Commit

Permalink
bugfix(LD_LIBRARY_PATH): fix error of duplicating LD_LIBRARY_PATH values
Browse files Browse the repository at this point in the history
  • Loading branch information
imhuwq committed Dec 11, 2023
1 parent 98b0e63 commit 4f28555
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions deepdataspace/services/dds.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,20 +315,17 @@ def _init_shared_libs(self):
url = f"{self.dl_prefix}/lib/libcurl.so.4.8.0"
download_by_requests(url, config.SHARED_CURL_LIB)

if config.LD_LIBRARY_PATH is None:
config.LD_LIBRARY_PATH = config.SHARED_LIB_DIR
elif config.SHARED_LIB_DIR is not None and config.LD_LIBRARY_PATH != config.SHARED_LIB_DIR:
config.LD_LIBRARY_PATH = f"{config.SHARED_LIB_DIR}:{config.LD_LIBRARY_PATH}"
paths = {config.SHARED_LIB_DIR}
if config.LD_LIBRARY_PATH:
for path in config.LD_LIBRARY_PATH.split(":"):
paths.add(path)

ld_path = os.environ.get("LD_LIBRARY_PATH", None)
if ld_path is not None:
config.LD_LIBRARY_PATH = f"{ld_path}:{config.LD_LIBRARY_PATH}"

current_lib_paths = find_shared_dirs_on_ubuntu()
current_lib_paths = ":".join(current_lib_paths)
if current_lib_paths:
config.LD_LIBRARY_PATH = f"{current_lib_paths}:{config.LD_LIBRARY_PATH}"
lib_paths = find_shared_dirs_on_ubuntu()
for path in lib_paths:
paths.add(path)

ld_library_path = ":".join(paths)
config.LD_LIBRARY_PATH = ld_library_path
os.environ["LD_LIBRARY_PATH"] = config.LD_LIBRARY_PATH

def _init_sentry(self):
Expand Down

0 comments on commit 4f28555

Please sign in to comment.