2022-10-21 18:38:19 +00:00
|
|
|
{ lib
|
2022-10-30 15:09:59 +00:00
|
|
|
, stdenv
|
2022-10-21 18:38:19 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, cython
|
|
|
|
, fetchFromGitHub
|
2022-10-30 15:09:59 +00:00
|
|
|
, libiconv
|
2022-10-21 18:38:19 +00:00
|
|
|
, pandas
|
|
|
|
, python
|
|
|
|
, pythonOlder
|
|
|
|
, readstat
|
|
|
|
, zlib
|
|
|
|
}:
|
2022-10-06 18:32:54 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyreadstat";
|
|
|
|
version = "1.1.9";
|
2022-10-21 18:38:19 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2022-10-06 18:32:54 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Roche";
|
|
|
|
repo = "pyreadstat";
|
|
|
|
rev = "v${version}";
|
2022-10-21 18:38:19 +00:00
|
|
|
hash = "sha256-OtvAvZTmcBTGfgp3Ddp9JJuZegr1o6c7rTMOuLwJSpk=";
|
2022-10-06 18:32:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cython
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
zlib
|
2022-10-30 15:09:59 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
libiconv
|
2022-10-06 18:32:54 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
readstat
|
|
|
|
pandas
|
|
|
|
];
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"pyreadstat"
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d);
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
${python.interpreter} tests/test_basic.py
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2022-10-06 18:32:54 +00:00
|
|
|
description = "Python package to read SAS, SPSS and Stata files into pandas data frames using the readstat C library";
|
2022-10-21 18:38:19 +00:00
|
|
|
homepage = "https://github.com/Roche/pyreadstat";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ swflint ];
|
2022-10-06 18:32:54 +00:00
|
|
|
};
|
|
|
|
}
|