setup.py: Update for cython extension.

This commit is contained in:
Chris PeBenito 2017-12-20 11:30:32 -05:00
parent 90a9e54a89
commit 51b53eb4a5
5 changed files with 13 additions and 10 deletions

4
.gitignore vendored
View File

@ -1,3 +1,4 @@
/.idea
/build
/dist
/setools.egg-info
@ -6,8 +7,7 @@
libqpol/policy_parse.c
libqpol/policy_parse.h
libqpol/policy_scan.c
setools/policyrep/qpol_wrap.c
setools/policyrep/qpol.py
/setools/policyrep/libpolicyrep.c
*.so
# Qt Generated Help files

View File

@ -7,6 +7,8 @@ include libqpol/include/qpol/*.h
include man/*
include qhc/*
include setools/perm_map
include setools/policyrep/*.pxi
include setools/policyrep/libpolicyrep.pyx
include setoolsui/*.ui
include setoolsui/apol/*.ui
include setoolsui/apol/apol.qhc

View File

@ -30,7 +30,7 @@ addition to the development packages from the above list:
* bison
* flex
* libsepol 2.7+
* SWIG 2.0.12+ or 3.0+ (3.0.8+ required for Python 3.5)
* cython 0.27+
To run SETools unit tests, the following packages are required, in
addition to the above dependencies:

View File

@ -12,6 +12,7 @@ import sys
import os
from os.path import join
from contextlib import suppress
from Cython.Build import cythonize
class QtHelpCommand(Command):
@ -107,8 +108,8 @@ if sys.platform.startswith('darwin'):
else:
macros=[]
ext_py_mods = [Extension('setools.policyrep._qpol',
['setools/policyrep/qpol.i',
ext_py_mods = [Extension('setools.policyrep.libpolicyrep',
['setools/policyrep/libpolicyrep.pyx',
'libqpol/avrule_query.c',
'libqpol/bool_query.c',
'libqpol/bounds_query.c',
@ -155,14 +156,11 @@ ext_py_mods = [Extension('setools.policyrep._qpol',
'-Wnested-externs',
'-Wold-style-definition',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wstrict-prototypes',
'-Wunknown-pragmas',
'-Wwrite-strings',
'-Wno-missing-field-initializers', # SWIG 3.0.2 generates partially-initialized structs
'-Wno-unused-parameter', # SWIG generates functions with unused parameters
'-Wno-sign-compare', # Bison
'-Wno-cast-qual', # libsepol uses const-to-nonconst casts
'-Wno-shadow', # SWIG generates shadow variables
'-Wno-unreachable-code', # Bison generates unreachable code
'-fno-exceptions'],
swig_opts=['-Ilibqpol/include'],
@ -183,7 +181,7 @@ setup(name='setools',
scripts=['apol', 'sediff', 'seinfo', 'seinfoflow', 'sesearch', 'sedta'],
data_files=[(join(sys.prefix, 'share/man/man1'), glob.glob("man/*.1"))],
package_data={'': ['*.ui', '*.qhc', '*.qch'], 'setools': ['perm_map']},
ext_modules=ext_py_mods,
ext_modules=cythonize(ext_py_mods),
test_suite='tests',
license='GPLv2+, LGPLv2.1+',
classifiers=[

View File

@ -20,6 +20,7 @@ commands = pep8 --version
[testenv:coverage]
deps = networkx==2.0
coverage
cython>=0.27
commands = coverage --version
coverage erase
coverage run setup.py test
@ -28,6 +29,7 @@ commands = coverage --version
[testenv:lint]
deps = pylint
networkx==2.0
cython>=0.27
commands = {envpython} setup.py build_ext -i
pylint --version
pylint -E --rcfile .pylintrc setools tests seinfo seinfoflow sedta sesearch sediff
@ -36,5 +38,6 @@ commands = {envpython} setup.py build_ext -i
[testenv]
deps = networkx==2.0
cython>=0.27
commands = {envpython} setup.py test
recreate = True