[med-svn] [kineticstools] 08/10: Enable build-time tests with respected exit code
Afif Elghraoui
afif at moszumanska.debian.org
Sun Jul 3 03:37:05 UTC 2016
This is an automated email from the git hooks/post-receive script.
afif pushed a commit to branch master
in repository kineticstools.
commit 5cdfb86bad6de84d00343eae0d25630c2d582d47
Author: Afif Elghraoui <afif at ghraoui.name>
Date: Sat Jul 2 19:06:57 2016 -0700
Enable build-time tests with respected exit code
---
debian/patches/compiled-extension.patch | 63 +++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
debian/rules | 11 +++---
3 files changed, 69 insertions(+), 6 deletions(-)
diff --git a/debian/patches/compiled-extension.patch b/debian/patches/compiled-extension.patch
new file mode 100644
index 0000000..904834a
--- /dev/null
+++ b/debian/patches/compiled-extension.patch
@@ -0,0 +1,63 @@
+Description: Improve detection of compiled extension
+ The original code cannot detect the library if the package is not installed,
+ which prevents running the unit tests at build time.
+ Changes were also necessary for python to be able to find the compiled
+ extension after pybuild renames it with the multiarch triplet.
+Author: Afif Elghraoui <afif at debian.org>
+Forwarded: no
+Last-Update: 2016-07-02
+
+--- kineticstools.orig/kineticsTools/ipdModel.py
++++ kineticstools/kineticsTools/ipdModel.py
+@@ -34,8 +34,8 @@
+ import h5py
+ import numpy as np
+ import ctypes as C
++import sysconfig
+ from kineticsTools.sharedArray import SharedArray
+-from pkg_resources import Requirement, resource_filename
+
+ byte = np.dtype('byte')
+ float32 = np.dtype('float32')
+@@ -67,9 +67,6 @@
+
+ codeToBase = dict([(y, x) for (x, y) in baseToCode.items()])
+
+-def _getAbsPath(fname):
+- return resource_filename(Requirement.parse('kineticsTools'),'kineticsTools/%s' % fname)
+-
+ class GbmContextModel(object):
+
+ """
+@@ -156,23 +153,16 @@
+
+ import platform
+
+- if platform.system() == "Windows":
++ path = os.path.dirname(os.path.abspath(__file__))
++ libbasename = "tree_predict"
+
+- libfn = "tree_predict.dll"
+- path = os.path.dirname(os.path.abspath(__file__))
+- windowsLib = path + os.path.sep + libfn
+-
+- if os.path.exists(windowsLib):
+- self._lib = np.ctypeslib.load_library(libfn, path)
+- else:
+- raise Exception("can't find tree_predict.dll")
++ multiarch_lib = '.'.join([libbasename,
++ sysconfig.get_config_var('MULTIARCH'),
++ 'so'])
++ if os.path.exists(path + os.path.sep + multiarch_lib):
++ self._lib = np.ctypeslib.load_library(multiarch_lib, path)
+ else:
+- DLL_PATH = _getAbsPath("tree_predict.so")
+-
+- if os.path.exists(DLL_PATH):
+- self._lib = np.ctypeslib.load_library("tree_predict.so", DLL_PATH)
+- else:
+- raise Exception("can't find tree_predict.so")
++ self._lib = np.ctypeslib.load_library(libbasename, path)
+
+ lpb = self._lib
+
diff --git a/debian/patches/series b/debian/patches/series
index b63b987..7ef7489 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ man-pages.patch
tests-import.patch
deactivate-tests-requiring-unavailable-data.patch
verbose-testing.patch
+compiled-extension.patch
diff --git a/debian/rules b/debian/rules
index 494182b..b3b51bb 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,6 +5,11 @@ include /usr/share/dpkg/default.mk
export LC_ALL=C.UTF-8
export PYBUILD_NAME=kineticstools
+export PYBUILD_TEST_NOSE=1
+export NOSE_VERBOSE=2
+export NOSE_NOCAPTURE=1
+export NOSE_INCLUDE_EXE=1
+export NOSE_TESTS=$(shell ls $(CURDIR)/test/*.py | tr '[:space:]' ',')
INSTDIR = $(CURDIR)/debian/$(DEB_SOURCE)
BINDIR = $(INSTDIR)/usr/bin
@@ -13,12 +18,6 @@ MANDIR = $(INSTDIR)/usr/share/man/
%:
dh $@ --with python2 --buildsystem=pybuild
-override_dh_auto_test:
-# Ignore error code here since there looks to be
-# a spurious DistributionNotFound error for some reason
- -PYBUILD_SYSTEM=custom \
- PYBUILD_TEST_ARGS="$(MAKE) unit-tests" dh_auto_test
-
override_dh_auto_install:
dh_auto_install
mkdir -p $(BINDIR)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/kineticstools.git
More information about the debian-med-commit
mailing list