Fixed an issue in Utilities.determinePythonVersion() when handling a spource that had been split into lines already. 5_5_x

Sat, 13 Dec 2014 11:43:31 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 13 Dec 2014 11:43:31 +0100
branch
5_5_x
changeset 3969
1abc44583ef2
parent 3965
019c23eb9e0a
child 3973
f77cdeea80e3

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]

eric ide

mercurial