Globals/__init__.py

Sun, 17 Feb 2013 19:07:15 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 17 Feb 2013 19:07:15 +0100
changeset 2426
da76c71624de
parent 2302
f29e9405c851
child 2525
8b507a9a2d40
child 2608
01118174a2f5
permissions
-rw-r--r--

Updated to Pygments 1.6.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
2302
f29e9405c851 Updated copyright for 2013.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2087
diff changeset
3 # Copyright (c) 2006 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module defining common data to be used by all modules.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import sys
1162
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
11 import os
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
13 from PyQt4.QtCore import QDir
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
14
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 # names of the various settings objects
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 settingsNameOrganization = "Eric5"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 settingsNameGlobal = "eric5"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 settingsNameRecent = "eric5recent"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 # key names of the various recent entries
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 recentNameMultiProject = "MultiProjects"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 recentNameProject = "Projects"
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 recentNameFiles = "Files"
1221
291dc0a51947 Added code to the cooperation functions to support IPv6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1162
diff changeset
24 recentNameHosts = "Hosts6"
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
26 configDir = None
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
27
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
28
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 def isWindowsPlatform():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 Function to check, if this is a Windows platform.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 @return flag indicating Windows platform (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 return sys.platform.startswith("win")
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
36
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
37
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
38 def isMacPlatform():
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
39 """
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
40 Function to check, if this is a Mac platform.
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
41
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
42 @return flag indicating Mac platform (boolean)
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
43 """
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
44 return sys.platform == "darwin"
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
45
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 882
diff changeset
46
882
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
47 def isLinuxPlatform():
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
48 """
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
49 Function to check, if this is a Linux platform.
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
50
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
51 @return flag indicating Linux platform (boolean)
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
52 """
34b86be88bf0 Redid the native file dialog code to be future proof.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
53 return sys.platform.startswith("linux")
1162
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
54
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
55
2087
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
56 def checkBlacklistedVersions():
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
57 """
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
58 Module functions to check for blacklisted versions of the prerequisites.
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
59
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
60 @return flag indicating good versions were found (boolean)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
61 """
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
62 from install import BlackLists, PlatformsBlackLists
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
63
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
64 # determine the platform dependent black list
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
65 if isWindowsPlatform():
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
66 PlatformBlackLists = PlatformsBlackLists["windows"]
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
67 elif isLinuxPlatform():
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
68 PlatformBlackLists = PlatformsBlackLists["linux"]
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
69 else:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
70 PlatformBlackLists = PlatformsBlackLists["mac"]
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
71
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
72 # check version of sip
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
73 try:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
74 import sipconfig
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
75 sipVersion = sipconfig.Configuration().sip_version_str
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
76 # always assume, that snapshots are good
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
77 if "snapshot" not in sipVersion:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
78 # check for blacklisted versions
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
79 for vers in BlackLists["sip"] + PlatformBlackLists["sip"]:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
80 if vers == sipVersion:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
81 print('Sorry, sip version {0} is not compatible with eric5.'\
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
82 .format(vers))
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
83 print('Please install another version.')
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
84 return False
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
85 except ImportError:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
86 pass
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
87
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
88 # check version of PyQt
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
89 from PyQt4.QtCore import PYQT_VERSION_STR
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
90 pyqtVersion = PYQT_VERSION_STR
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
91 # always assume, that snapshots are good
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
92 if "snapshot" not in pyqtVersion:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
93 # check for blacklisted versions
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
94 for vers in BlackLists["PyQt4"] + PlatformBlackLists["PyQt4"]:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
95 if vers == pyqtVersion:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
96 print('Sorry, PyQt4 version {0} is not compatible with eric5.'\
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
97 .format(vers))
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
98 print('Please install another version.')
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
99 return False
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
100
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
101 # check version of QScintilla
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
102 from PyQt4.Qsci import QSCINTILLA_VERSION_STR
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
103 scintillaVersion = QSCINTILLA_VERSION_STR
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
104 # always assume, that snapshots are new enough
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
105 if "snapshot" not in scintillaVersion:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
106 # check for blacklisted versions
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
107 for vers in BlackLists["QScintilla2"] + PlatformBlackLists["QScintilla2"]:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
108 if vers == scintillaVersion:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
109 print('Sorry, QScintilla2 version {0} is not compatible with eric5.'\
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
110 .format(vers))
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
111 print('Please install another version.')
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
112 return False
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
113
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
114 return True
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
115
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
116
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
117 def getConfigDir():
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
118 """
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
119 Module function to get the name of the directory storing the config data.
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
120
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
121 @return directory name of the config dir (string)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
122 """
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
123 if configDir is not None and os.path.exists(configDir):
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
124 hp = configDir
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
125 else:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
126 if isWindowsPlatform():
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
127 cdn = "_eric5"
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
128 else:
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
129 cdn = ".eric5"
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
130
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
131 hp = QDir.homePath()
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
132 dn = QDir(hp)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
133 dn.mkdir(cdn)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
134 hp += "/" + cdn
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
135 return QDir.toNativeSeparators(hp)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
136
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
137
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
138 def setConfigDir(d):
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
139 """
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
140 Module function to set the name of the directory storing the config data.
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
141
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
142 @param d name of an existing directory (string)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
143 """
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
144 global configDir
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
145 configDir = os.path.expanduser(d)
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
146
795992a5c561 Made the sixth set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
147
1162
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
148 ################################################################################
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
149 ## functions for searching a Python2 interpreter
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
150 ################################################################################
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
151
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
152
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
153 def findPython2Interpreters():
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
154 """
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
155 Module function for searching a Python2 interpreter.
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
156
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
157 @return list of interpreters found (list of strings)
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
158 """
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
159 winPathList = ["C:\\Python25", "C:\\Python26", "C:\\Python27", "C:\\Python28"]
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
160 posixPathList = ["/usr/bin", "/usr/local/bin"]
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
161 posixVersionsList = ["2.5", "2.6", "2.7", "2.8"]
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
162
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
163 interpreters = []
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
164 if isWindowsPlatform():
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
165 # search the interpreters on Windows platforms
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
166 for path in winPathList:
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
167 exeList = [
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
168 "python.exe",
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
169 "python{0}.{1}.exe".format(path[-2], path[-1]),
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
170 ]
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
171 for exe in exeList:
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
172 interpreter = os.path.join(path, exe)
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
173 if os.path.isfile(interpreter):
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
174 interpreters.append(interpreter)
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
175 else:
1363
d650915a903c Some changes for Mac computers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1221
diff changeset
176 # search interpreters on Posix and Mac platforms
1162
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
177 for path in posixPathList:
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
178 for version in posixVersionsList:
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
179 interpreter = os.path.join(path, "python{0}".format(version))
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
180 if os.path.isfile(interpreter):
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
181 interpreters.append(interpreter)
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
182
ab292b7f4f8a Added code to search for a Python2 interpreter in some known places. If none is found, the user can configure it on the Debugger, Python config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
183 return interpreters

eric ide

mercurial