Merge pull request #119258 from drewrisinger/dr-pr-fix-python-tables
This commit is contained in:
commit
ef9a1d4c57
|
@ -1,9 +1,26 @@
|
||||||
{ lib, fetchPypi, python, buildPythonPackage, isPy38
|
{ lib
|
||||||
, cython, bzip2, lzo, numpy, numexpr, hdf5, six, c-blosc, mock }:
|
, fetchPypi
|
||||||
|
, fetchurl
|
||||||
|
, fetchpatch
|
||||||
|
, buildPythonPackage
|
||||||
|
, pythonOlder
|
||||||
|
, python
|
||||||
|
, bzip2
|
||||||
|
, c-blosc
|
||||||
|
, cython
|
||||||
|
, hdf5
|
||||||
|
, lzo
|
||||||
|
, numpy
|
||||||
|
, numexpr
|
||||||
|
, setuptools
|
||||||
|
# Test inputs
|
||||||
|
, pytestCheckHook
|
||||||
|
}:
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
version = "3.6.1";
|
|
||||||
pname = "tables";
|
pname = "tables";
|
||||||
|
version = "3.6.1";
|
||||||
|
disabled = pythonOlder "3.5";
|
||||||
|
|
||||||
src = fetchPypi {
|
src = fetchPypi {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
|
@ -12,12 +29,33 @@ buildPythonPackage rec {
|
||||||
|
|
||||||
nativeBuildInputs = [ cython ];
|
nativeBuildInputs = [ cython ];
|
||||||
|
|
||||||
buildInputs = [ hdf5 bzip2 lzo c-blosc ];
|
buildInputs = [
|
||||||
propagatedBuildInputs = [ numpy numexpr six mock ];
|
bzip2
|
||||||
|
c-blosc
|
||||||
|
hdf5
|
||||||
|
lzo
|
||||||
|
];
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
numpy
|
||||||
|
numexpr
|
||||||
|
setuptools # uses pkg_resources at runtime
|
||||||
|
];
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
(fetchpatch {
|
||||||
|
# Needed for numpy >= 1.20.0
|
||||||
|
name = "tables-pr-862-use-lowercase-numpy-dtypes.patch";
|
||||||
|
url = "https://github.com/PyTables/PyTables/commit/93a3272b8fe754095637628b4d312400e24ae654.patch";
|
||||||
|
sha256 = "00czgxnm1dxp9763va9xw1nc7dd7kxh9hjcg9klim52519hkbhi4";
|
||||||
|
})
|
||||||
|
];
|
||||||
# When doing `make distclean`, ignore docs
|
# When doing `make distclean`, ignore docs
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace Makefile --replace "src doc" "src"
|
substituteInPlace Makefile --replace "src doc" "src"
|
||||||
|
# Force test suite to error when unittest runner fails
|
||||||
|
substituteInPlace tables/tests/test_suite.py \
|
||||||
|
--replace "return 0" "assert result.wasSuccessful(); return 0" \
|
||||||
|
--replace "return 1" "assert result.wasSuccessful(); return 1"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Regenerate C code with Cython
|
# Regenerate C code with Cython
|
||||||
|
@ -25,44 +63,29 @@ buildPythonPackage rec {
|
||||||
make distclean
|
make distclean
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# The setup script complains about missing run-paths, but they are
|
|
||||||
# actually set.
|
|
||||||
setupPyBuildFlags = [
|
setupPyBuildFlags = [
|
||||||
"--hdf5=${lib.getDev hdf5}"
|
"--hdf5=${lib.getDev hdf5}"
|
||||||
"--lzo=${lib.getDev lzo}"
|
"--lzo=${lib.getDev lzo}"
|
||||||
"--bzip2=${lib.getDev bzip2}"
|
"--bzip2=${lib.getDev bzip2}"
|
||||||
"--blosc=${lib.getDev c-blosc}"
|
"--blosc=${lib.getDev c-blosc}"
|
||||||
];
|
];
|
||||||
# Run the test suite.
|
|
||||||
# It requires the build path to be in the python search path.
|
|
||||||
# These tests take quite some time.
|
|
||||||
# If the hdf5 library is built with zlib then there is only one
|
|
||||||
# test-failure. That is the same failure as described in the following
|
|
||||||
# github issue:
|
|
||||||
# https://github.com/PyTables/PyTables/issues/269
|
|
||||||
checkPhase = ''
|
|
||||||
${python.interpreter} <<EOF
|
|
||||||
import sysconfig
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
f = "lib.{platform}-{version[0]}.{version[1]}"
|
|
||||||
lib = f.format(platform=sysconfig.get_platform(),
|
|
||||||
version=sys.version_info)
|
|
||||||
build = os.path.join(os.getcwd(), 'build', lib)
|
|
||||||
sys.path.insert(0, build)
|
|
||||||
import tables
|
|
||||||
r = tables.test()
|
|
||||||
if not r.wasSuccessful():
|
|
||||||
sys.exit(1)
|
|
||||||
EOF
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Disable tests until the failure described above is fixed.
|
checkInputs = [ pytestCheckHook ];
|
||||||
doCheck = false;
|
preCheck = ''
|
||||||
|
cd ..
|
||||||
|
'';
|
||||||
|
# Runs the test suite as one single test via unittest. The whole "heavy" test suite supposedly takes ~5 hours to run.
|
||||||
|
pytestFlagsArray = [
|
||||||
|
"--pyargs"
|
||||||
|
"tables.tests.test_suite"
|
||||||
|
];
|
||||||
|
|
||||||
|
pythonImportsCheck = [ "tables" ];
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Hierarchical datasets for Python";
|
description = "Hierarchical datasets for Python";
|
||||||
homepage = "http://www.pytables.org/";
|
homepage = "https://www.pytables.org/";
|
||||||
license = licenses.bsd2;
|
license = licenses.bsd2;
|
||||||
|
maintainers = with maintainers; [ drewrisinger ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,12 @@
|
||||||
let inherit (lib) optional optionals; in
|
let inherit (lib) optional optionals; in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
version = "1.10.7";
|
# 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
|
||||||
|
version = "1.10.6";
|
||||||
pname = "hdf5";
|
pname = "hdf5";
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${lib.versions.majorMinor version}/${pname}-${version}/src/${pname}-${version}.tar.bz2";
|
url = "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${lib.versions.majorMinor version}/${pname}-${version}/src/${pname}-${version}.tar.bz2";
|
||||||
sha256 = "0pm5xxry55i0h7wmvc7svzdaa90rnk7h78rrjmnlkz2ygsn8y082";
|
sha256 = "1gf38x51128hn00744358w27xgzjk0ff4wra4yxh2lk804ck1mh9";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
outputs = [ "out" "dev" ];
|
||||||
|
|
Loading…
Reference in a new issue