15
0
forked from pool/python-emoji

Accepting request 910366 from home:theMarix:branches:devel:languages:python

- Update to 1.4.2
  * Added support for German naming of emojis.
  * Added support for French naming of emojis.
  * Added new function `replace_emoji` which strips emojis from
    output.
- Add patch `fix-python2.patch`: Fixes unicode emoji names on Python
  2.

OBS-URL: https://build.opensuse.org/request/show/910366
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-emoji?expand=0&rev=22
This commit is contained in:
2021-08-06 05:46:13 +00:00
committed by Git OBS Bridge
parent 81696c4ebf
commit 12435d22a2
5 changed files with 39 additions and 6 deletions

22
fix-python2.patch Normal file
View File

@@ -0,0 +1,22 @@
From: Matthias Bach <marix@marix.org>
Date: 2021-07-31 11:57:53 2021 +0200
Subject: Fix matching of non-ASCII emoji names on Python 2
References: https://github.com/carpedm20/emoji/pull/181
Upstream: merged
A fix to get the tests passing for the French language in 1.4.1 sadly was incomplete and only worked for Python 3. This extends the patch to also work on Python 2.
diff --git a/emoji/core.py b/emoji/core.py
index 7221937..ade232e 100644
--- a/emoji/core.py
+++ b/emoji/core.py
@@ -55,7 +55,7 @@ def emojize(
Python is fun ❤️ #red heart, not black heart
"""
EMOJI_UNICODE = unicode_codes.EMOJI_UNICODE[language]
- pattern = re.compile(u'(%s[\\w\\-&.’”“()!#*+?,/]+%s)' % delimiters)
+ pattern = re.compile(u'(%s[\\w\\-&.’”“()!#*+?,/]+%s)' % delimiters, flags=re.UNICODE)
def replace(match):
mg = match.group(1).replace(delimiters[0], _DEFAULT_DELIMITER).replace(