1{ stdenv, lib, fetchPypi, python, buildPythonPackage, isPy38
2, cython, bzip2, lzo, numpy, numexpr, hdf5, six, c-blosc, mock }:
3
4with stdenv.lib;
5
6buildPythonPackage rec {
7 version = "3.6.1";
8 pname = "tables";
9
10 src = fetchPypi {
11 inherit pname version;
12 sha256 = "0j8vnxh2m5n0cyk9z3ndcj5n1zj5rdxgc1gb78bqlyn2lyw75aa9";
13 };
14
15 nativeBuildInputs = [ cython ];
16
17 buildInputs = [ hdf5 bzip2 lzo c-blosc ];
18 propagatedBuildInputs = [ numpy numexpr six mock ];
19
20 # When doing `make distclean`, ignore docs
21 postPatch = ''
22 substituteInPlace Makefile --replace "src doc" "src"
23 '';
24
25 # Regenerate C code with Cython
26 preBuild = ''
27 make distclean
28 '';
29
30 # The setup script complains about missing run-paths, but they are
31 # actually set.
32 setupPyBuildFlags = [
33 "--hdf5=${getDev hdf5}"
34 "--lzo=${getDev lzo}"
35 "--bzip2=${getDev bzip2}"
36 "--blosc=${getDev c-blosc}"
37 ];
38 # Run the test suite.
39 # It requires the build path to be in the python search path.
40 # These tests take quite some time.
41 # If the hdf5 library is built with zlib then there is only one
42 # test-failure. That is the same failure as described in the following
43 # github issue:
44 # https://github.com/PyTables/PyTables/issues/269
45 checkPhase = ''
46 ${python.interpreter} <<EOF
47 import sysconfig
48 import sys
49 import os
50 f = "lib.{platform}-{version[0]}.{version[1]}"
51 lib = f.format(platform=sysconfig.get_platform(),
52 version=sys.version_info)
53 build = os.path.join(os.getcwd(), 'build', lib)
54 sys.path.insert(0, build)
55 import tables
56 r = tables.test()
57 if not r.wasSuccessful():
58 sys.exit(1)
59 EOF
60 '';
61
62 # Disable tests until the failure described above is fixed.
63 doCheck = false;
64
65 meta = {
66 description = "Hierarchical datasets for Python";
67 homepage = "http://www.pytables.org/";
68 license = stdenv.lib.licenses.bsd2;
69 };
70}