summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu-Jie Lin <livibetter@gmail.com>2014-07-19 19:11:00 +0800
committerYu-Jie Lin <livibetter@gmail.com>2014-07-19 19:11:00 +0800
commit7c7745a0f2266a790463eb2242d6f94eb4ae95db (patch)
tree260b46d50bbc3f42fb23af1fe529b69022db7779
parent0687395733fe134f5c607d8d5f0a9bb527bdcf7a (diff)
downloadsmartypants-7c7745a0f2266a790463eb2242d6f94eb4ae95db.tar.gz
fix codecs mbcs bug in distutils
-rwxr-xr-xsetup.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index 7f3775d..ff1ea76 100755
--- a/setup.py
+++ b/setup.py
@@ -40,6 +40,19 @@ EXCLUDE_SCRIPTS = (
# ============================================================================
+# https://groups.google.com/d/msg/comp.lang.python/pAeiF0qwtY0/H9Ki0WOctBkJ
+# Work around mbcs bug in distutils.
+# http://bugs.python.org/issue10945
+
+try:
+ codecs.lookup('mbcs')
+except LookupError:
+ ascii = codecs.lookup('ascii')
+ func = lambda name, enc=ascii: {True: enc}.get(name == 'mbcs')
+ codecs.register(func)
+
+
+# ============================================================================
class cmd_test(Command):