3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #203334 from dotlambda/dateparser-1.1.4

python310Packages.dateparser: 1.1.3 -> 1.1.4
This commit is contained in:
Mario Rodas 2022-11-29 09:23:28 -05:00 committed by GitHub
commit ca0b19f76f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 25 deletions

View file

@ -1,6 +1,6 @@
{ lib
, buildPythonPackage
, isPy3k
, pythonOlder
, fetchFromGitHub
, fetchpatch
, python-dateutil
@ -21,27 +21,19 @@
buildPythonPackage rec {
pname = "dateparser";
version = "1.1.3";
version = "1.1.4";
disabled = !isPy3k;
disabled = pythonOlder "3.7";
format = "setuptools";
src = fetchFromGitHub {
owner = "scrapinghub";
repo = "dateparser";
rev = "v${version}";
sha256 = "sha256-2bZaaaLT3hocIiqLZpudP6gmiYwxPNMrjG9dYF3GvTc=";
sha256 = "sha256-r13WNI+T2NtTwjnGOqX3ZOqPhvr8fBdXGULW7IXszlo=";
};
patches = [
./regex-compat.patch
];
postPatch = ''
substituteInPlace setup.py --replace \
'regex !=2019.02.19,!=2021.8.27,<2022.3.15' \
'regex'
'';
propagatedBuildInputs = [
python-dateutil
pytz
@ -80,6 +72,7 @@ buildPythonPackage rec {
pythonImportsCheck = [ "dateparser" ];
meta = with lib; {
changelog = "https://github.com/scrapinghub/dateparser/blob/${src.rev}/HISTORY.rst";
description = "Date parsing library designed to parse dates from HTML pages";
homepage = "https://github.com/scrapinghub/dateparser";
license = licenses.bsd3;

View file

@ -1,11 +0,0 @@
--- a/dateparser/languages/locale.py
+++ b/dateparser/languages/locale.py
@@ -169,7 +169,7 @@ class Locale:
if normalize:
value = list(map(normalize_unicode, value))
pattern = '|'.join(sorted(value, key=len, reverse=True))
- pattern = DIGIT_GROUP_PATTERN.sub(r'?P<n>\d+', pattern)
+ pattern = pattern.replace(r'\d+', r'?P<n>\d+')
pattern = re.compile(r'^(?:{})$'.format(pattern), re.UNICODE | re.IGNORECASE)
relative_dictionary[pattern] = key
return relative_dictionary