Utilities/__init__.py

changeset 97
c4086afea02b
parent 69
2e78b0aab87e
child 114
f6e7cec11168
equal deleted inserted replaced
96:9624a110667d 97:c4086afea02b
28 28
29 from E5Gui.E5Application import e5App 29 from E5Gui.E5Application import e5App
30 30
31 from UI.Info import Program, Version 31 from UI.Info import Program, Version
32 32
33 from eric5config import getConfig
34 import Preferences 33 import Preferences
35 34
36 configDir = None 35 configDir = None
37 36
38 codingBytes_regexps = [ 37 codingBytes_regexps = [
67 """ 66 """
68 def __init__(self, coding): 67 def __init__(self, coding):
69 """ 68 """
70 Constructor 69 Constructor
71 """ 70 """
72 self.errorMessage = QApplication.translate("CodingError", 71 self.errorMessage = QCoreApplication.translate("CodingError",
73 "The coding '{0}' is wrong for the given text.").format(coding) 72 "The coding '{0}' is wrong for the given text.").format(coding)
74 73
75 def __repr__(self): 74 def __repr__(self):
76 """ 75 """
77 Private method returning a representation of the exception. 76 Private method returning a representation of the exception.
873 vl = re.findall("[0-9.]*", pyFullVers)[0].split(".") 872 vl = re.findall("[0-9.]*", pyFullVers)[0].split(".")
874 major = vl[0] 873 major = vl[0]
875 minor = vl[1] 874 minor = vl[1]
876 875
877 pyVers = major + "." + minor 876 pyVers = major + "." + minor
878 pyVersNr = int(major) * 10 + int(minor)
879 877
880 if isWindowsPlatform(): 878 if isWindowsPlatform():
881 libDir = sys.prefix + "\\Lib" 879 libDir = sys.prefix + "\\Lib"
882 else: 880 else:
883 try: 881 try:
926 import quixote.ptl_compile 924 import quixote.ptl_compile
927 except ImportError: 925 except ImportError:
928 return (False, None, None, None, None) 926 return (False, None, None, None, None)
929 template = quixote.ptl_compile.Template(codestring, file) 927 template = quixote.ptl_compile.Template(codestring, file)
930 template.compile() 928 template.compile()
931 codeobject = template.code
932 else: 929 else:
933 codeobject = builtins.compile(codestring, file, 'exec') 930 builtins.compile(codestring, file, 'exec')
934 except SyntaxError as detail: 931 except SyntaxError as detail:
935 import traceback, re 932 import traceback, re
936 lines = traceback.format_exception_only(SyntaxError, detail) 933 lines = traceback.format_exception_only(SyntaxError, detail)
937 match = re.match('\s*File "(.+)", line (\d+)', 934 match = re.match('\s*File "(.+)", line (\d+)',
938 lines[0].replace('<string>', '%s' % file)) 935 lines[0].replace('<string>', '%s' % file))

eric ide

mercurial