Skip to content

Commit c8cc559

Browse files
committed
fix astanin#56: workaround for missing re.sub flags support in IronPython
1 parent e58f6bb commit c8cc559

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

setup.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from distutils.core import setup
77

88

9-
from platform import python_version_tuple
9+
from platform import python_version_tuple, python_implementation
1010
import os
1111
import re
1212

@@ -21,9 +21,16 @@
2121
LONG_DESCRIPTION = open("README.rst", "r").read().replace("`_", "`")
2222

2323
# strip Build Status from the PyPI package
24-
if python_version_tuple()[:2] >= ('2', '7'):
25-
LONG_DESCRIPTION = re.sub("^Build status\n(.*\n){7}", "", LONG_DESCRIPTION, flags=re.M)
26-
24+
try:
25+
if python_version_tuple()[:2] >= ('2', '7'):
26+
status_re = "^Build status\n(.*\n){7}"
27+
LONG_DESCRIPTION = re.sub(status_re, "", LONG_DESCRIPTION, flags=re.M)
28+
except TypeError:
29+
if python_implementation() == "IronPython":
30+
# IronPython doesn't support flags in re.sub (IronPython issue #923)
31+
pass
32+
else:
33+
raise
2734

2835
install_options = os.environ.get("TABULATE_INSTALL","").split(",")
2936
libonly_flags = set(["lib-only", "libonly", "no-cli", "without-cli"])

0 commit comments

Comments
 (0)