def scan_code_for_ctypes(co):
binaries = []
__recursivly_scan_code_objects_for_ctypes(co, binaries)
# If any of the libraries has been requested with anything
# different then the bare filename, drop that entry and warn
# the user - pyinstaller would need to patch the compiled pyc
# file to make it work correctly!
binaries = set(binaries)
for binary in list(binaries):
# 'binary' might be in some cases None. Some Python
# modules might contain code like the following. For
# example PyObjC.objc._bridgesupport contain code like
# that.
# dll = ctypes.CDLL(None)
if not binary:
# None values has to be removed too.
binaries.remove(binary)
elif binary != os.path.basename(binary):
# TODO make these warnings show up somewhere.
logger.warn("ignoring %s - ctypes imports only supported using bare filenames", binary)
binaries = _resolveCtypesImports(binaries)
return binaries
评论列表
文章目录