find_libraries: search for both .so and .dylib on macOS (#28924)
This commit is contained in:
		@@ -1638,12 +1638,18 @@ def find_libraries(libraries, root, shared=True, recursive=False):
 | 
				
			|||||||
        raise TypeError(message)
 | 
					        raise TypeError(message)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Construct the right suffix for the library
 | 
					    # Construct the right suffix for the library
 | 
				
			||||||
    if shared is True:
 | 
					    if shared:
 | 
				
			||||||
        suffix = 'dylib' if sys.platform == 'darwin' else 'so'
 | 
					        # Used on both Linux and macOS
 | 
				
			||||||
 | 
					        suffixes = ['so']
 | 
				
			||||||
 | 
					        if sys.platform == 'darwin':
 | 
				
			||||||
 | 
					            # Only used on macOS
 | 
				
			||||||
 | 
					            suffixes.append('dylib')
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        suffix = 'a'
 | 
					        suffixes = ['a']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # List of libraries we are searching with suffixes
 | 
					    # List of libraries we are searching with suffixes
 | 
				
			||||||
    libraries = ['{0}.{1}'.format(lib, suffix) for lib in libraries]
 | 
					    libraries = ['{0}.{1}'.format(lib, suffix) for lib in libraries
 | 
				
			||||||
 | 
					                 for suffix in suffixes]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if not recursive:
 | 
					    if not recursive:
 | 
				
			||||||
        # If not recursive, look for the libraries directly in root
 | 
					        # If not recursive, look for the libraries directly in root
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user