2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
2022-03-30 09:31:56 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, python
|
|
|
|
, nose
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cchardet";
|
2020-11-03 02:18:15 +00:00
|
|
|
version = "2.1.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2020-11-03 02:18:15 +00:00
|
|
|
sha256 = "c428b6336545053c2589f6caf24ea32276c6664cb86db817e03a94c60afa0eaf";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"cchardet"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
checkInputs = [ nose ];
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
# on non x86-64 some charsets are identified as their superset, so we skip these tests (last checked with version 2.1.7)
|
2022-02-10 20:34:41 +00:00
|
|
|
preCheck = ''
|
|
|
|
cp -R src/tests $TMPDIR
|
|
|
|
pushd $TMPDIR
|
2022-03-30 09:31:56 +00:00
|
|
|
'' + lib.optionalString (stdenv.hostPlatform.system != "x86_64-linux") ''
|
|
|
|
rm $TMPDIR/tests/testdata/th/tis-620.txt # identified as iso-8859-11, which is fine for all practical purposes
|
|
|
|
rm $TMPDIR/tests/testdata/ga/iso-8859-1.txt # identified as windows-1252, which is fine for all practical purposes
|
|
|
|
rm $TMPDIR/tests/testdata/fi/iso-8859-1.txt # identified as windows-1252, which is fine for all practical purposes
|
2022-02-10 20:34:41 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
checkPhase = ''
|
2022-02-10 20:34:41 +00:00
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
nosetests
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
postCheck = ''
|
|
|
|
popd
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "High-speed universal character encoding detector";
|
|
|
|
homepage = "https://github.com/PyYoshi/cChardet";
|
|
|
|
license = lib.licenses.mpl11;
|
|
|
|
maintainers = with lib.maintainers; [ ivan ];
|
|
|
|
};
|
|
|
|
}
|