From 7c7745a0f2266a790463eb2242d6f94eb4ae95db Mon Sep 17 00:00:00 2001 From: Yu-Jie Lin Date: Sat, 19 Jul 2014 19:11:00 +0800 Subject: fix codecs mbcs bug in distutils --- setup.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/setup.py b/setup.py index 7f3775d..ff1ea76 100755 --- a/setup.py +++ b/setup.py @@ -39,6 +39,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) + + # ============================================================================ -- cgit v1.2.1