Skip to content

Commit a0e464e

Browse files
committed
Deal better with sre_parse deprecation
1 parent ab03cfd commit a0e464e

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# ChangeLog for replacer
22

3+
*replacer-3.4
4+
Martin Väth <martin at mvath.de>:
5+
- Deal better with sre_parse deprecation:
6+
Suppress warning and check if sre_parse.expand_template exists.
7+
38
*replacer-3.3
49
Martin Väth <martin at mvath.de>:
510
- Make replacer work with current versions of colorama.

bin/replacer

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,23 @@ import locale
1111
import os
1212
import re
1313
import sys
14+
import warnings
15+
warnings.filterwarnings("ignore", category=DeprecationWarning)
1416

15-
version = '3.3'
17+
version = '3.4'
1618

1719
# Set localedir to e.g. '/usr/share/locale' to fix the gettext (nls) path.
1820
# If localedir == '', the value is fetched from $REPLACER_NLS or $NLS.
1921
# If localedir is None, gettext (nls) is not used.
2022
localedir = ''
2123

24+
warnings.filterwarnings("ignore", category=DeprecationWarning)
2225
try:
2326
import sre_parse
24-
have_sre_parse = True
27+
have_sre_parse = "expand_template" in dir(sre_parse)
2528
except ImportError:
2629
have_sre_parse = False
30+
warnings.resetwarnings()
2731

2832
if localedir is not None:
2933
try:

0 commit comments

Comments
 (0)