summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2018-05-10 19:25:34 -0400
committerPaul Moore <paul@paul-moore.com>2018-05-10 19:25:34 -0400
commit8ad3638ea9023c3948976dfadebd1554380a31c9 (patch)
tree7c7cf1feee88e14413ac4b6173ab67da9bb5a1f3
parenta9745ef2c36eba7828ef466aaa9eaafea281d6f6 (diff)
downloadlibseccomp-8ad3638ea9023c3948976dfadebd1554380a31c9.tar.gz
build: enable distcheck'ing for the python code
I'm not particularly proud of the seccomp.pyx hack, but it works, and enabling the python bindings during the distcheck is definitely the "Greater Good". Signed-off-by: Paul Moore <paul@paul-moore.com>
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac1
-rw-r--r--src/python/Makefile.am13
-rw-r--r--tests/Makefile.am1
-rwxr-xr-xtests/regression7
5 files changed, 20 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am
index d476037..b69cec5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,6 +32,9 @@ AM_MAKEFLAGS_1 =
AM_MAKEFLAGS_ = ${AM_MAKEFLAGS_0}
AM_MAKEFLAGS = ${AM_MAKEFLAGS_@AM_V@}
+# enable python during distcheck
+AM_DISTCHECK_CONFIGURE_FLAGS = --enable-python
+
check-build: all
${MAKE} ${AM_MAKEFLAGS} -C src check-build
${MAKE} ${AM_MAKEFLAGS} -C tests check-build
diff --git a/configure.ac b/configure.ac
index c593caf..34746a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,6 +112,7 @@ AS_IF([test "$enable_python" = yes], [
AS_IF([test "$CYTHON_VER_MAJ" -eq 0 -a "$CYTHON_VER_MIN" -lt 16], [
AC_MSG_ERROR([python bindings require cython 0.16 or higher])
])
+ AM_PATH_PYTHON
])
AM_CONDITIONAL([ENABLE_PYTHON], [test "$enable_python" = yes])
AC_DEFINE_UNQUOTED([ENABLE_PYTHON],
diff --git a/src/python/Makefile.am b/src/python/Makefile.am
index 7933a4e..3a34b0a 100644
--- a/src/python/Makefile.am
+++ b/src/python/Makefile.am
@@ -16,14 +16,12 @@
# along with this library; if not, see <http://www.gnu.org/licenses>.
#
-PYTHON = /usr/bin/env python
-
PY_DISTUTILS = \
VERSION_RELEASE="@PACKAGE_VERSION@" \
CPPFLAGS="-I\${top_srcdir}/include ${AM_CPPFLAGS} ${CPPFLAGS}" \
CFLAGS="${AM_CFLAGS} ${CFLAGS}" \
LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}" \
- ${PYTHON} ./setup.py
+ ${PYTHON} ${srcdir}/setup.py
# support silent builds
PY_BUILD_0 = @echo " PYTHON " $@; ${PY_DISTUTILS} -q build
@@ -38,10 +36,17 @@ EXTRA_DIST = libseccomp.pxd seccomp.pyx setup.py
all-local: build
build: ../libseccomp.la libseccomp.pxd seccomp.pyx setup.py
+ [ ${srcdir} == ${builddir} ] || cp ${srcdir}/seccomp.pyx ${builddir}
${PY_BUILD} && touch build
install-exec-local: build
- ${PY_INSTALL} --prefix=${DESTDIR}/${prefix}
+ ${PY_INSTALL} --install-lib=${DESTDIR}/${pkgpythondir} \
+ --record=${DESTDIR}/${pkgpythondir}/install_files.txt
+
+uninstall-local:
+ cat ${DESTDIR}/${pkgpythondir}/install_files.txt | xargs ${RM} -f
+ ${RM} -f ${DESTDIR}/${pkgpythondir}/install_files.txt
clean-local:
+ [ ${srcdir} == ${builddir} ] || ${RM} -f ${builddir}/seccomp.pyx
${RM} -rf seccomp.c build
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6cd8130..e3762ff 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -125,6 +125,7 @@ EXTRA_DIST_TESTPYTHON = \
35-sim-negative_one.py \
36-sim-ipc_syscalls.py \
37-sim-ipc_syscalls_be.py \
+ 39-basic-api_level.py \
40-sim-log.py \
41-sim-syscall_priority_arch.py \
42-sim-adv_chains.py \
diff --git a/tests/regression b/tests/regression
index 2a7a502..3c8ab51 100755
--- a/tests/regression
+++ b/tests/regression
@@ -215,7 +215,12 @@ function run_test_command() {
if [[ $mode == "python" ]]; then
cmd="PYTHONPATH=$PYTHONPATH"
cmd="$cmd:$(cd $(pwd)/../src/python/build/lib.*; pwd)"
- cmd="$cmd /usr/bin/env python $2.py $3"
+ # check and adjust if we are doing a VPATH build
+ if [[ -e "./$2.py" ]]; then
+ cmd="$cmd /usr/bin/env python $2.py $3"
+ else
+ cmd="$cmd /usr/bin/env python ${srcdir}/$2.py $3"
+ fi
else
cmd="$2 $3"
fi