From a4b0ea5b8fb80217c438219eb6522b7aa17db865 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Mon, 12 Jan 2015 14:08:21 +0800 Subject: [PATCH] fix find_library --- shadowsocks/crypto/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shadowsocks/crypto/util.py b/shadowsocks/crypto/util.py index 68cfabd..c8cbab5 100644 --- a/shadowsocks/crypto/util.py +++ b/shadowsocks/crypto/util.py @@ -32,7 +32,7 @@ def find_library(possible_lib_names, search_symbol, library_name): paths = [] - if type(possible_lib_names) is not list: + if type(possible_lib_names) not in (list, tuple): possible_lib_names = [possible_lib_names] for name in possible_lib_names: @@ -105,10 +105,11 @@ def run_cipher(cipher, decipher): def test_find_library(): assert find_library('c', 'strcpy', 'libc') is not None assert find_library(['c'], 'strcpy', 'libc') is not None + assert find_library(('c',), 'strcpy', 'libc') is not None assert find_library('crypto', 'EVP_CipherUpdate', 'libcrypto') is not None assert find_library('notexist', 'strcpy', 'libnotexist') is None assert find_library('c', 'symbol_not_exist', 'c') is None - assert find_library(['notexist', 'c', 'crypto'], + assert find_library(('notexist', 'c', 'crypto'), 'EVP_CipherUpdate', 'libc') is not None