summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Node
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-03-19 23:19:49 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2017-03-19 23:19:49 (GMT)
commit47b6a4d1c7da1e93bbfc7ec283746c72ff3d920e (patch)
tree0ee15a4ad43ffd2448a1ad91787b0c8c6d27e454 /src/engine/SCons/Node
parent81ced582305f177bb43f9f9474100cb0688d51ca (diff)
downloadSCons-47b6a4d1c7da1e93bbfc7ec283746c72ff3d920e.zip
SCons-47b6a4d1c7da1e93bbfc7ec283746c72ff3d920e.tar.gz
SCons-47b6a4d1c7da1e93bbfc7ec283746c72ff3d920e.tar.bz2
py2/3 switch from using starts with to a slice of the contents. With py3 contents is a byte array, not a string and so lacks the startswith method
Diffstat (limited to 'src/engine/SCons/Node')
-rw-r--r--src/engine/SCons/Node/FS.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index c3841eb..7172c50 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -2672,11 +2672,11 @@ class File(Base):
# them, but has a 'utf-8-sig' which does; 'utf-16' seems to
# strip them; etc.) Just sidestep all the complication by
# explicitly stripping the BOM before we decode().
- if contents.startswith(codecs.BOM_UTF8):
+ if contents[:len(codecs.BOM_UTF8)] == codecs.BOM_UTF8:
return contents[len(codecs.BOM_UTF8):].decode('utf-8')
- if contents.startswith(codecs.BOM_UTF16_LE):
+ if contents[:len(codecs.BOM_UTF16_LE)] == codecs.BOM_UTF16_LE:
return contents[len(codecs.BOM_UTF16_LE):].decode('utf-16-le')
- if contents.startswith(codecs.BOM_UTF16_BE):
+ if contents[:len(codecs.BOM_UTF16_BE)] == codecs.BOM_UTF16_BE:
return contents[len(codecs.BOM_UTF16_BE):].decode('utf-16-be')
try:
return contents.decode()