def _findlib(libnames, path=None):
"""."""
platform = sys.platform
if platform in ("win32", "cli"):
pattern = "%s.dll"
elif platform == "darwin":
pattern = "lib%s.dylib"
else:
pattern = "lib%s.so"
searchfor = libnames
if type(libnames) is dict:
# different library names for the platforms
if platform == "cli" and platform not in libnames:
# if not explicitly specified, use the Win32 libs for IronPython
platform = "win32"
if platform not in libnames:
platform = "DEFAULT"
searchfor = libnames[platform]
results = []
if path:
for libname in searchfor:
for subpath in str.split(path, os.pathsep):
dllfile = os.path.join(subpath, pattern % libname)
if os.path.exists(dllfile):
results.append(dllfile)
for libname in searchfor:
dllfile = find_library(libname)
if dllfile:
results.append(dllfile)
return results
评论列表
文章目录