From: Amit Bawer <abawer.com(a)gmail.com>
tox -e py27 will invoke
make PY_VERSION=2.7
tox -e py36 will invoke
make PY_VERSION=3.6
At this point rpm spec invokes
make PY_VERSION=2.7
co-authored with Pavel Bar <pbar(a)redhat.com>
Signed-off-by: Amit Bawer <abawer(a)redhat.com>
---
python/Makefile | 6 ++++--
sanlock.spec.in | 3 ++-
tox.ini | 3 ++-
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/python/Makefile b/python/Makefile
index c97e45a..2caf6a8 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -2,14 +2,16 @@
#
# 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.
+PYTHON := python$(PY_VERSION)
+
all:
- python2 setup.py build $(BUILDARGS)
+ $(PYTHON) setup.py build $(BUILDARGS)
install:
- python2 setup.py install --root=$(DESTDIR)
+ $(PYTHON) setup.py install --root=$(DESTDIR)
clean:
rm -rf build
diff --git a/sanlock.spec.in b/sanlock.spec.in
index c31599d..6485c61 100644
--- a/sanlock.spec.in
+++ b/sanlock.spec.in
@@ -59,11 +59,12 @@ make -C src \
make -C wdmd \
install LIBDIR=%{_libdir} \
DESTDIR=$RPM_BUILD_ROOT
make -C python \
install LIBDIR=%{_libdir} \
- DESTDIR=$RPM_BUILD_ROOT
+ DESTDIR=$RPM_BUILD_ROOT \
+ PY_VERSION=2.7 # TODO: fix PY_VERSION to 3.6 when 2020 will arrive
make -C reset \
install LIBDIR=%{_libdir} \
DESTDIR=$RPM_BUILD_ROOT
diff --git a/tox.ini b/tox.ini
index d21f2f3..5a48b23 100644
--- a/tox.ini
+++ b/tox.ini
@@ -16,11 +16,12 @@ setenv =
SANLOCK_RUN_DIR=/tmp/sanlock
whitelist_externals = make
deps =
pytest==4.0
commands =
- make BUILDARGS="--build-lib={envsitepackagesdir}"
+ py27: make PY_VERSION=2.7 BUILDARGS="--build-lib={envsitepackagesdir}"
+ py36: make PY_VERSION=3.6 BUILDARGS="--build-lib={envsitepackagesdir}"
pytest {posargs}
[pytest]
# Notes:
# --basetemp: we must use /var/tmp as sanlock uses direct I/O.
--
2.17.2