Add error check for missing libsepol.so

The setup.py script attempts to locate the 'libsepol.so' library
if the SEPOL environment variable is not set, but does not fail
safely if the find fails. This commit adds error checking if the
'libsepol.so' is not located.
This commit is contained in:
Jake Valletta 2016-05-10 14:16:53 -04:00
parent a87015d4b5
commit 1655fb7e56

View File

@ -85,6 +85,12 @@ except KeyError:
# this assumes that the static lib is in the same directory
# as the dynamic lib.
dynamic_sepol = UnixCCompiler().find_library_file(['.', '/usr/lib64', '/usr/lib'], 'sepol')
if dynamic_sepol is None:
print('Unable to find a libsepol.so on your system!')
print('Please set the SEPOL environment variable. Exiting.')
exit(1)
static_sepol = dynamic_sepol.replace(".so", ".a")
if sys.platform.startswith('darwin'):