Utilities/__init__.py

changeset 3968
19d287451e44
parent 3833
64b5f5fa3b00
child 4000
e91713926d1a
equal deleted inserted replaced
3967:383a043d62ec 3968:19d287451e44
1453 pyVer = pyAssignment.get(project.getProjectLanguage(), 0) 1453 pyVer = pyAssignment.get(project.getProjectLanguage(), 0)
1454 elif ext in py2Ext and ext not in py3Ext: 1454 elif ext in py2Ext and ext not in py3Ext:
1455 pyVer = 2 1455 pyVer = 2
1456 elif ext in py3Ext and ext not in py2Ext: 1456 elif ext in py3Ext and ext not in py2Ext:
1457 pyVer = 3 1457 pyVer = 3
1458 elif source.startswith("#!"): 1458 else:
1459 line0 = source.splitlines()[0] 1459 if isinstance(source, basestring):
1460 if "python3" in line0: 1460 line0 = source.splitlines()[0]
1461 pyVer = 3 1461 else:
1462 elif "python" in line0: 1462 line0 = source[0]
1463 pyVer = 2 1463 if line0.startswith("#!"):
1464 if "python3" in line0:
1465 pyVer = 3
1466 elif "python" in line0:
1467 pyVer = 2
1464 1468
1465 if pyVer == 0 and ext in py2Ext + py3Ext: 1469 if pyVer == 0 and ext in py2Ext + py3Ext:
1466 pyVer = sys.version_info[0] 1470 pyVer = sys.version_info[0]
1467 1471
1468 if editor and pyVer: 1472 if editor and pyVer:

eric ide

mercurial