From 336d27698f19fa594c11cda12527051e2a46cdde Mon Sep 17 00:00:00 2001 From: jonathan Date: Sun, 9 Aug 2020 14:57:12 -0700 Subject: [PATCH] Fixed libsodium library reference: added version specificity --- setup.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 33e2b0d..83b5426 100644 --- a/setup.py +++ b/setup.py @@ -21,6 +21,19 @@ def __str__(self): import pybind11 return pybind11.get_include(self.user) +def get_libsodium_path(libsodiumver='libsodium.so.23'): + ''' + Function to find the path to the requisite libsodium library. + + Version can be specified as desired, defaults to 23 (e.g. - looks for libsodium.so.23) + ''' + paths = glob.glob('/usr/lib/**/{:s}'.format(libsodiumver), recursive=True) + if len(paths) == 0: + print("ERROR: Please install libsodium == {:s}".format(libsodiumver)) + sys.exit(1) + else: + return paths[0] + ext_modules = [ Extension( @@ -47,7 +60,7 @@ def __str__(self): get_pybind_include(user=True) ], extra_objects=[ - glob.glob('/usr/lib/**/libsodium.so*', recursive=True)[0] + get_libsodium_path() ], language='c++' ),