1{ lib 2, buildPythonPackage 3, isPy3k 4, fetchFromGitHub 5, fetchpatch 6, python-dateutil 7, pytz 8, regex 9, tzlocal 10, hijri-converter 11, convertdate 12, fasttext 13, langdetect 14, parameterized 15, pytestCheckHook 16, GitPython 17, parsel 18, requests 19, ruamel-yaml 20}: 21 22buildPythonPackage rec { 23 pname = "dateparser"; 24 version = "1.1.3"; 25 26 disabled = !isPy3k; 27 28 src = fetchFromGitHub { 29 owner = "scrapinghub"; 30 repo = "dateparser"; 31 rev = "v${version}"; 32 sha256 = "sha256-2bZaaaLT3hocIiqLZpudP6gmiYwxPNMrjG9dYF3GvTc="; 33 }; 34 35 patches = [ 36 ./regex-compat.patch 37 ]; 38 39 postPatch = '' 40 substituteInPlace setup.py --replace \ 41 'regex !=2019.02.19,!=2021.8.27,<2022.3.15' \ 42 'regex' 43 ''; 44 45 propagatedBuildInputs = [ 46 python-dateutil 47 pytz 48 regex 49 tzlocal 50 ]; 51 52 passthru.optional-dependencies = { 53 calendars = [ hijri-converter convertdate ]; 54 fasttext = [ fasttext ]; 55 langdetect = [ langdetect ]; 56 }; 57 58 checkInputs = [ 59 parameterized 60 pytestCheckHook 61 GitPython 62 parsel 63 requests 64 ruamel-yaml 65 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies); 66 67 preCheck = '' 68 export HOME="$TEMPDIR" 69 ''; 70 71 # Upstream only runs the tests in tests/ in CI, others use git clone 72 pytestFlagsArray = [ "tests" ]; 73 74 disabledTests = [ 75 # access network 76 "test_custom_language_detect_fast_text_0" 77 "test_custom_language_detect_fast_text_1" 78 ]; 79 80 pythonImportsCheck = [ "dateparser" ]; 81 82 meta = with lib; { 83 description = "Date parsing library designed to parse dates from HTML pages"; 84 homepage = "https://github.com/scrapinghub/dateparser"; 85 license = licenses.bsd3; 86 maintainers = with maintainers; [ dotlambda ]; 87 }; 88}