Sat, 13 Dec 2014 11:43:31 +0100
Fixed an issue in Utilities.determinePythonVersion() when handling a spource that had been split into lines already.
(grafted from 19d287451e44e718498f7a1a0bc73a03ce94efa5)
Utilities/__init__.py | file | annotate | diff | comparison | revisions |
--- a/Utilities/__init__.py Sun Dec 07 15:02:44 2014 +0100 +++ b/Utilities/__init__.py Sat Dec 13 11:43:31 2014 +0100 @@ -1455,12 +1455,16 @@ pyVer = 2 elif ext in py3Ext and ext not in py2Ext: pyVer = 3 - elif source.startswith("#!"): - line0 = source.splitlines()[0] - if "python3" in line0: - pyVer = 3 - elif "python" in line0: - pyVer = 2 + else: + if isinstance(source, basestring): + line0 = source.splitlines()[0] + else: + line0 = source[0] + if line0.startswith("#!"): + if "python3" in line0: + pyVer = 3 + elif "python" in line0: + pyVer = 2 if pyVer == 0 and ext in py2Ext + py3Ext: pyVer = sys.version_info[0]