Replace the python Makefile inplace target with environment variable, so the top Makefile can be simplified to:
$(SUBDIRS): $(MAKE) -C $@
When running tox, we build sanlock extension inside the tox relevant tox environment (e.g. .tox/py27/...). This will be helpful for supporting python 3.
On Travis we still build in the python directory - sanlock import fails if we build it elsewhere. This is not an issue for python 3 since on Travis we have separate build for every python version.
Signed-off-by: Nir Soffer nsoffer@redhat.com --- .travis.yml | 5 ++--- Makefile | 2 +- python/Makefile | 5 +---- tox.ini | 4 +--- 4 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/.travis.yml b/.travis.yml index 8cc2859..37643f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ dist: xenial language: python +python: 2.7
addons: apt: sources: - ubuntu-toolchain-r-test @@ -14,10 +15,8 @@ before_install:
env: - CC="gcc-8"
script: - - make -C wdmd - - make -C src - - make -C python inplace + - make BUILDARGS="--build-lib=." - source tests/env.sh - pytest diff --git a/Makefile b/Makefile index bc1b3ce..8b41526 100644 --- a/Makefile +++ b/Makefile @@ -11,11 +11,11 @@ distname := sanlock-$(version) tarball := $(distname).tar.gz
all: $(MAKE) -C wdmd $(MAKE) -C src - $(MAKE) -C python inplace + $(MAKE) -C python
clean: $(MAKE) -C wdmd clean $(MAKE) -C src clean $(MAKE) -C python clean diff --git a/python/Makefile b/python/Makefile index 06c2201..c97e45a 100644 --- a/python/Makefile +++ b/python/Makefile @@ -3,14 +3,11 @@ # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions # of the GNU General Public License v.2.
all: - python2 setup.py build - -inplace: - python2 setup.py build_ext --inplace + python2 setup.py build $(BUILDARGS)
install: python2 setup.py install --root=$(DESTDIR)
clean: diff --git a/tox.ini b/tox.ini index f65f487..1c2349e 100644 --- a/tox.ini +++ b/tox.ini @@ -12,17 +12,15 @@ skip_missing_interpreters = True passenv = USER setenv = LD_LIBRARY_PATH={env:PWD}/wdmd:{env:PWD}/src SANLOCK_PRIVILEGED=0 SANLOCK_RUN_DIR=/tmp/sanlock - PYTHONPATH={env:PWD}/python -sitepackages = True whitelist_externals = make deps = pytest==4.0 commands = - make + make BUILDARGS="--build-lib={envsitepackagesdir}" pytest {posargs}
[pytest] # Notes: # --basetemp: we must use /var/tmp as sanlock uses direct I/O.
sanlock-devel@lists.fedorahosted.org