From: stevenknight Date: Sat, 20 Dec 2008 14:01:33 +0000 (+0000) Subject: Issue 2276: Fix use of codecs module in pre-2.3 Python versions. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c7b7e8df063211388131b0a1f5bc9274525c106c;p=scons.git Issue 2276: Fix use of codecs module in pre-2.3 Python versions. git-svn-id: http://scons.tigris.org/svn/scons/trunk@3836 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index bdc1bfd2..4e89e8d4 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -51,6 +51,19 @@ try: import codecs except ImportError: pass +else: + # TODO(2.2): Remove when 2.3 becomes the minimal supported version. + try: + codecs.BOM_UTF8 + except AttributeError: + codecs.BOM_UTF8 = '\xef\xbb\xbf' + try: + codecs.BOM_UTF16 + except AttributeError: + if sys.byteorder == 'little': + codecs.BOM_UTF16 = '\xff\xfe' + else: + codecs.BOM_UTF16 = '\xfe\xff' import SCons.Action from SCons.Debug import logInstanceCreation