mirror of
https://github.com/hacksider/Deep-Live-Cam.git
synced 2026-06-01 18:21:38 +02:00
Avoid duplicating LD_LIBRARY_PATH entries
Skip prepending a directory that is already on LD_LIBRARY_PATH, so a repeated import of run.py does not bloat the variable. Addresses review feedback on #1826.
This commit is contained in:
@@ -52,10 +52,13 @@ if sys.platform.startswith("linux"):
|
||||
_lib_dir = os.path.join(_nvidia_dir, _pkg, "lib")
|
||||
if not os.path.isdir(_lib_dir):
|
||||
continue
|
||||
# Also expose the directory to child processes
|
||||
os.environ["LD_LIBRARY_PATH"] = (
|
||||
_lib_dir + os.pathsep + os.environ.get("LD_LIBRARY_PATH", "")
|
||||
)
|
||||
# Also expose the directory to child processes, without
|
||||
# duplicating an entry that is already present.
|
||||
_ldp = os.environ.get("LD_LIBRARY_PATH", "")
|
||||
if _lib_dir not in _ldp.split(os.pathsep):
|
||||
os.environ["LD_LIBRARY_PATH"] = (
|
||||
_lib_dir + (os.pathsep + _ldp if _ldp else "")
|
||||
)
|
||||
for _so in sorted(glob.glob(os.path.join(_lib_dir, "lib*.so*"))):
|
||||
try:
|
||||
ctypes.CDLL(_so, mode=ctypes.RTLD_GLOBAL)
|
||||
|
||||
Reference in New Issue
Block a user