mirror of
https://github.com/SELinuxProject/setools
synced 2025-02-10 00:46:54 +00:00
Make libselinux bindings optional.
This commit is contained in:
parent
20ee139f3b
commit
ab3772843e
29
.travis.yml
29
.travis.yml
@ -4,25 +4,17 @@
|
||||
|
||||
language: python
|
||||
|
||||
# These environments have to be spelled
|
||||
# out so that libselinux bindings get
|
||||
# the right Python version.
|
||||
matrix:
|
||||
include:
|
||||
- python: "2.7"
|
||||
env: TOX_ENV=py27
|
||||
- python: "3.3"
|
||||
env: TOX_ENV=py33
|
||||
- python: "3.4"
|
||||
env: TOX_ENV=py34
|
||||
- python: "3.3"
|
||||
env: TOX_ENV=coverage
|
||||
- env: TOX_ENV=pep8
|
||||
- env: TOX_ENV=lint
|
||||
env:
|
||||
- TOX_ENV=py27
|
||||
- TOX_ENV=py33
|
||||
- TOX_ENV=py34
|
||||
- TOX_ENV=pep8
|
||||
- TOX_ENV=coverage
|
||||
- TOX_ENV=lint
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- python: "3.3"
|
||||
env: TOX_ENV=coverage
|
||||
- env: TOX_ENV=coverage
|
||||
|
||||
before_install:
|
||||
- lsb_release -a
|
||||
@ -58,9 +50,6 @@ before_install:
|
||||
# error: declaration of 'index' shadows a global declarationo
|
||||
- sudo make CFLAGS="-O2 -pipe -fPIC -Wall" -C selinux-src install
|
||||
|
||||
# Install libselinux Python bindings.
|
||||
- sudo make CFLAGS="-O2 -pipe -fPIC -Wall" -C selinux-src/libselinux install-pywrap
|
||||
|
||||
# Ubuntu 12.04's flex generates a redundant decl in libqpol
|
||||
- sed -i -e "/Wwrite-strings/s/,/, '-Wno-redundant-decls',/" setup.py
|
||||
|
||||
|
@ -17,7 +17,7 @@ To run SETools, the following packages are required:
|
||||
* Python 2.7 or 3.3+
|
||||
* NetworkX 1.8+
|
||||
* setuptools
|
||||
* libselinux (including Python bindings)
|
||||
* libselinux (Python bindings optional but recommended)
|
||||
* libbz2
|
||||
|
||||
To build SETools, the following development packages are required, in
|
||||
|
@ -26,7 +26,10 @@ import logging
|
||||
from itertools import chain
|
||||
from errno import ENOENT
|
||||
|
||||
import selinux
|
||||
try:
|
||||
import selinux
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
from . import qpol
|
||||
|
||||
@ -82,7 +85,10 @@ class SELinuxPolicy(object):
|
||||
if policyfile:
|
||||
self._load_policy(policyfile)
|
||||
else:
|
||||
self._load_running_policy()
|
||||
try:
|
||||
self._load_running_policy()
|
||||
except NameError:
|
||||
raise RuntimeError("Loading the running policy requires libselinux Python bindings")
|
||||
|
||||
def __repr__(self):
|
||||
return "<SELinuxPolicy(\"{0}\")>".format(self.filename)
|
||||
|
Loading…
Reference in New Issue
Block a user