MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / _use_ldconfig

Function _use_ldconfig

tensorpack/utils/utils.py:288–304  ·  view source on GitHub ↗

Find so in `ldconfig -p`. It does not handle LD_LIBRARY_PATH.

(name)

Source from the content-addressed store, hash-verified

286 return os.path.realpath(res)
287
288 def _use_ldconfig(name):
289 """
290 Find so in `ldconfig -p`.
291 It does not handle LD_LIBRARY_PATH.
292 """
293 with change_env('LC_ALL', 'C'), change_env('LANG', 'C'):
294 ldconfig, ret = subproc_call("ldconfig -p")
295 ldconfig = ldconfig.decode('utf-8')
296 if ret != 0:
297 return None
298 expr = r'\s+(lib%s\.[^\s]+)\s+\(.*=>\s+(.*)' % (re.escape(name))
299 res = re.search(expr, ldconfig)
300 if not res:
301 return None
302 else:
303 ret = res.group(2)
304 return os.path.realpath(ret)
305
306 if sys.platform.startswith('linux'):
307 return _use_proc_maps(name) or _use_ld(name) or _use_ldconfig(name) or find_library(name)

Callers 1

find_library_full_pathFunction · 0.85

Calls 3

change_envFunction · 0.85
subproc_callFunction · 0.85
groupMethod · 0.80

Tested by

no test coverage detected