Merge pull request #119258 from drewrisinger/dr-pr-fix-python-tables

authored by Sandro and committed by GitHub ef9a1d4c cc73a46e

+58 -34
+55 -32
pkgs/development/python-modules/tables/default.nix
··· 1 - { lib, fetchPypi, python, buildPythonPackage, isPy38 2 - , cython, bzip2, lzo, numpy, numexpr, hdf5, six, c-blosc, mock }: 1 + { lib 2 + , fetchPypi 3 + , fetchurl 4 + , fetchpatch 5 + , buildPythonPackage 6 + , pythonOlder 7 + , python 8 + , bzip2 9 + , c-blosc 10 + , cython 11 + , hdf5 12 + , lzo 13 + , numpy 14 + , numexpr 15 + , setuptools 16 + # Test inputs 17 + , pytestCheckHook 18 + }: 3 19 4 20 buildPythonPackage rec { 5 - version = "3.6.1"; 6 21 pname = "tables"; 22 + version = "3.6.1"; 23 + disabled = pythonOlder "3.5"; 7 24 8 25 src = fetchPypi { 9 26 inherit pname version; ··· 12 29 13 30 nativeBuildInputs = [ cython ]; 14 31 15 - buildInputs = [ hdf5 bzip2 lzo c-blosc ]; 16 - propagatedBuildInputs = [ numpy numexpr six mock ]; 32 + buildInputs = [ 33 + bzip2 34 + c-blosc 35 + hdf5 36 + lzo 37 + ]; 38 + propagatedBuildInputs = [ 39 + numpy 40 + numexpr 41 + setuptools # uses pkg_resources at runtime 42 + ]; 17 43 44 + patches = [ 45 + (fetchpatch { 46 + # Needed for numpy >= 1.20.0 47 + name = "tables-pr-862-use-lowercase-numpy-dtypes.patch"; 48 + url = "https://github.com/PyTables/PyTables/commit/93a3272b8fe754095637628b4d312400e24ae654.patch"; 49 + sha256 = "00czgxnm1dxp9763va9xw1nc7dd7kxh9hjcg9klim52519hkbhi4"; 50 + }) 51 + ]; 18 52 # When doing `make distclean`, ignore docs 19 53 postPatch = '' 20 54 substituteInPlace Makefile --replace "src doc" "src" 55 + # Force test suite to error when unittest runner fails 56 + substituteInPlace tables/tests/test_suite.py \ 57 + --replace "return 0" "assert result.wasSuccessful(); return 0" \ 58 + --replace "return 1" "assert result.wasSuccessful(); return 1" 21 59 ''; 22 60 23 61 # Regenerate C code with Cython ··· 25 63 make distclean 26 64 ''; 27 65 28 - # The setup script complains about missing run-paths, but they are 29 - # actually set. 30 66 setupPyBuildFlags = [ 31 67 "--hdf5=${lib.getDev hdf5}" 32 68 "--lzo=${lib.getDev lzo}" 33 69 "--bzip2=${lib.getDev bzip2}" 34 70 "--blosc=${lib.getDev c-blosc}" 35 71 ]; 36 - # Run the test suite. 37 - # It requires the build path to be in the python search path. 38 - # These tests take quite some time. 39 - # If the hdf5 library is built with zlib then there is only one 40 - # test-failure. That is the same failure as described in the following 41 - # github issue: 42 - # https://github.com/PyTables/PyTables/issues/269 43 - checkPhase = '' 44 - ${python.interpreter} <<EOF 45 - import sysconfig 46 - import sys 47 - import os 48 - f = "lib.{platform}-{version[0]}.{version[1]}" 49 - lib = f.format(platform=sysconfig.get_platform(), 50 - version=sys.version_info) 51 - build = os.path.join(os.getcwd(), 'build', lib) 52 - sys.path.insert(0, build) 53 - import tables 54 - r = tables.test() 55 - if not r.wasSuccessful(): 56 - sys.exit(1) 57 - EOF 72 + 73 + checkInputs = [ pytestCheckHook ]; 74 + preCheck = '' 75 + cd .. 58 76 ''; 77 + # Runs the test suite as one single test via unittest. The whole "heavy" test suite supposedly takes ~5 hours to run. 78 + pytestFlagsArray = [ 79 + "--pyargs" 80 + "tables.tests.test_suite" 81 + ]; 59 82 60 - # Disable tests until the failure described above is fixed. 61 - doCheck = false; 83 + pythonImportsCheck = [ "tables" ]; 62 84 63 85 meta = with lib; { 64 86 description = "Hierarchical datasets for Python"; 65 - homepage = "http://www.pytables.org/"; 87 + homepage = "https://www.pytables.org/"; 66 88 license = licenses.bsd2; 89 + maintainers = with maintainers; [ drewrisinger ]; 67 90 }; 68 91 }
+3 -2
pkgs/tools/misc/hdf5/1.10.nix
··· 10 10 let inherit (lib) optional optionals; in 11 11 12 12 stdenv.mkDerivation rec { 13 - version = "1.10.7"; 13 + # pinned to 1.10.6 for pythonPackages.tables v3.6.1. tables has test errors for hdf5 > 1.10.6. https://github.com/PyTables/PyTables/issues/845 14 + version = "1.10.6"; 14 15 pname = "hdf5"; 15 16 src = fetchurl { 16 17 url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${lib.versions.majorMinor version}/${pname}-${version}/src/${pname}-${version}.tar.bz2"; 17 - sha256 = "0pm5xxry55i0h7wmvc7svzdaa90rnk7h78rrjmnlkz2ygsn8y082"; 18 + sha256 = "1gf38x51128hn00744358w27xgzjk0ff4wra4yxh2lk804ck1mh9"; 18 19 }; 19 20 20 21 outputs = [ "out" "dev" ];