MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / get_soname

Function get_soname

pipcl.py:3166–3189  ·  view source on GitHub ↗

If we are on Linux and `path` is softlink and points to a shared library for which `objdump -p` contains 'SONAME', return the pointee. Otherwise return `path`. Useful if Linux shared libraries have been created with `-Wl,-soname,...`, where we need to embed the versioned library.

(path)

Source from the content-addressed store, hash-verified

3164
3165
3166def get_soname(path):
3167 '''
3168 If we are on Linux and `path` is softlink and points to a shared library
3169 for which `objdump -p` contains 'SONAME', return the pointee. Otherwise
3170 return `path`. Useful if Linux shared libraries have been created with
3171 `-Wl,-soname,...`, where we need to embed the versioned library.
3172 '''
3173 if linux() and os.path.islink(path):
3174 path2 = os.path.realpath(path)
3175 if subprocess.run(f'objdump -p {path2}|grep SONAME', shell=1, check=0).returncode == 0:
3176 return path2
3177 elif openbsd():
3178 # Return newest .so with version suffix.
3179 sos = glob.glob(f'{path}.*')
3180 log1(f'{sos=}')
3181 sos2 = list()
3182 for so in sos:
3183 suffix = so[len(path):]
3184 if not suffix or re.match('^[.][0-9.]*[0-9]$', suffix):
3185 sos2.append(so)
3186 sos2.sort(key=lambda p: os.path.getmtime(p))
3187 log1(f'{sos2=}')
3188 return sos2[-1]
3189 return path
3190
3191
3192def current_py_limited_api():

Callers

nothing calls this directly

Calls 5

linuxFunction · 0.85
openbsdFunction · 0.85
log1Function · 0.85
runMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…