2021-04-05 15:23:46 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, isPy3k
|
|
|
|
, fetchFromGitHub
|
2022-11-02 22:02:43 +00:00
|
|
|
, fetchpatch
|
2021-07-04 02:40:35 +00:00
|
|
|
, python-dateutil
|
2020-04-24 23:36:52 +00:00
|
|
|
, pytz
|
|
|
|
, regex
|
2021-04-05 15:23:46 +00:00
|
|
|
, tzlocal
|
|
|
|
, hijri-converter
|
|
|
|
, convertdate
|
2021-10-08 15:17:17 +00:00
|
|
|
, fasttext
|
|
|
|
, langdetect
|
2021-04-05 15:23:46 +00:00
|
|
|
, parameterized
|
|
|
|
, pytestCheckHook
|
|
|
|
, GitPython
|
2022-11-21 17:40:18 +00:00
|
|
|
, parsel
|
|
|
|
, requests
|
2021-12-06 16:07:01 +00:00
|
|
|
, ruamel-yaml
|
2020-06-15 15:56:04 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "dateparser";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "1.1.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
disabled = !isPy3k;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "scrapinghub";
|
|
|
|
repo = "dateparser";
|
|
|
|
rev = "v${version}";
|
2022-11-21 17:40:18 +00:00
|
|
|
sha256 = "sha256-2bZaaaLT3hocIiqLZpudP6gmiYwxPNMrjG9dYF3GvTc=";
|
2021-04-05 15:23:46 +00:00
|
|
|
};
|
2020-06-15 15:56:04 +00:00
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
patches = [
|
|
|
|
./regex-compat.patch
|
|
|
|
];
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
postPatch = ''
|
2022-09-30 11:47:45 +00:00
|
|
|
substituteInPlace setup.py --replace \
|
|
|
|
'regex !=2019.02.19,!=2021.8.27,<2022.3.15' \
|
|
|
|
'regex'
|
2022-09-09 14:08:57 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
2022-11-21 17:40:18 +00:00
|
|
|
python-dateutil
|
|
|
|
pytz
|
|
|
|
regex
|
|
|
|
tzlocal
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
calendars = [ hijri-converter convertdate ];
|
|
|
|
fasttext = [ fasttext ];
|
|
|
|
langdetect = [ langdetect ];
|
|
|
|
};
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
checkInputs = [
|
|
|
|
parameterized
|
|
|
|
pytestCheckHook
|
|
|
|
GitPython
|
2022-11-21 17:40:18 +00:00
|
|
|
parsel
|
|
|
|
requests
|
2021-12-06 16:07:01 +00:00
|
|
|
ruamel-yaml
|
2022-11-21 17:40:18 +00:00
|
|
|
] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
|
2021-04-05 15:23:46 +00:00
|
|
|
|
2021-10-08 15:17:17 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME="$TEMPDIR"
|
|
|
|
'';
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
# Upstream only runs the tests in tests/ in CI, others use git clone
|
|
|
|
pytestFlagsArray = [ "tests" ];
|
|
|
|
|
2021-10-08 15:17:17 +00:00
|
|
|
disabledTests = [
|
|
|
|
# access network
|
|
|
|
"test_custom_language_detect_fast_text_0"
|
|
|
|
"test_custom_language_detect_fast_text_1"
|
|
|
|
];
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
pythonImportsCheck = [ "dateparser" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Date parsing library designed to parse dates from HTML pages";
|
|
|
|
homepage = "https://github.com/scrapinghub/dateparser";
|
|
|
|
license = licenses.bsd3;
|
2021-04-05 15:23:46 +00:00
|
|
|
maintainers = with maintainers; [ dotlambda ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|