14 import re |
14 import re |
15 import fnmatch |
15 import fnmatch |
16 import glob |
16 import glob |
17 import getpass |
17 import getpass |
18 import ctypes |
18 import ctypes |
19 import subprocess |
19 import subprocess # secok |
20 |
20 |
21 |
21 |
22 def __showwarning(message, category, filename, lineno, file=None, line=""): |
22 def __showwarning(message, category, filename, lineno, file=None, line=""): |
23 """ |
23 """ |
24 Module function to raise a SyntaxError for a SyntaxWarning. |
24 Module function to raise a SyntaxError for a SyntaxWarning. |
138 """ |
138 """ |
139 lines = text.splitlines() |
139 lines = text.splitlines() |
140 for coding in codingBytes_regexps: |
140 for coding in codingBytes_regexps: |
141 coding_re = coding[1] |
141 coding_re = coding[1] |
142 head = lines[:coding[0]] |
142 head = lines[:coding[0]] |
143 for l in head: |
143 for line in head: |
144 m = coding_re.search(l) |
144 m = coding_re.search(line) |
145 if m: |
145 if m: |
146 return str(m.group(1), "ascii").lower() |
146 return str(m.group(1), "ascii").lower() |
147 return None |
147 return None |
148 |
148 |
149 |
149 |
156 """ |
156 """ |
157 lines = text.splitlines() |
157 lines = text.splitlines() |
158 for coding in coding_regexps: |
158 for coding in coding_regexps: |
159 coding_re = coding[1] |
159 coding_re = coding[1] |
160 head = lines[:coding[0]] |
160 head = lines[:coding[0]] |
161 for l in head: |
161 for line in head: |
162 m = coding_re.search(l) |
162 m = coding_re.search(line) |
163 if m: |
163 if m: |
164 return m.group(1).lower() |
164 return m.group(1).lower() |
165 return None |
165 return None |
166 |
166 |
167 |
167 |
1326 ctypes.windll.kernel32.SetErrorMode(oldMode) |
1326 ctypes.windll.kernel32.SetErrorMode(oldMode) |
1327 else: |
1327 else: |
1328 # we are on a Linux or macOS platform |
1328 # we are on a Linux or macOS platform |
1329 for mountCommand in ["mount", "/sbin/mount", "/usr/sbin/mount"]: |
1329 for mountCommand in ["mount", "/sbin/mount", "/usr/sbin/mount"]: |
1330 try: |
1330 try: |
1331 mountOutput = (subprocess.check_output(mountCommand) |
1331 mountOutput = ( |
1332 .splitlines()) |
1332 subprocess.check_output(mountCommand).splitlines() # secok |
|
1333 ) |
1333 mountedVolumes = [x.split()[2] for x in mountOutput] |
1334 mountedVolumes = [x.split()[2] for x in mountOutput] |
1334 for volume in mountedVolumes: |
1335 for volume in mountedVolumes: |
1335 if volume.decode("utf-8").endswith(volumeName): |
1336 if volume.decode("utf-8").endswith(volumeName): |
1336 volumeDirectory = volume.decode("utf-8") |
1337 volumeDirectory = volume.decode("utf-8") |
1337 break |
1338 break |
1832 @param variant indicator for the PySide variant |
1833 @param variant indicator for the PySide variant |
1833 @type str |
1834 @type str |
1834 @return the PySide/PySide2 tool path with extension |
1835 @return the PySide/PySide2 tool path with extension |
1835 @rtype str |
1836 @rtype str |
1836 """ |
1837 """ |
1837 assert variant in ("1", "2") |
|
1838 |
|
1839 if isWindowsPlatform(): |
1838 if isWindowsPlatform(): |
1840 pysideInterpreters = checkPyside(variant) |
1839 pysideInterpreters = checkPyside(variant) |
1841 interpreterIndex = sys.version_info[0] - 2 |
1840 interpreterIndex = sys.version_info[0] - 2 |
1842 hasPyside = pysideInterpreters[interpreterIndex] |
1841 hasPyside = pysideInterpreters[interpreterIndex] |
1843 # if it isn't the internal interpreter, it has to be the external one |
1842 # if it isn't the internal interpreter, it has to be the external one |
1893 @type str |
1892 @type str |
1894 @return list of two flags indicating the presence of PySide/PySide2 for |
1893 @return list of two flags indicating the presence of PySide/PySide2 for |
1895 Python2 and PySide/PySide2 for Python3 |
1894 Python2 and PySide/PySide2 for Python3 |
1896 @rtype tuple of (bool, bool) |
1895 @rtype tuple of (bool, bool) |
1897 """ |
1896 """ |
1898 assert variant in ("1", "2") |
|
1899 |
|
1900 pysideInformation = [] |
1897 pysideInformation = [] |
1901 for venvNameKey in ["Python2VirtualEnv", "Python3VirtualEnv"]: |
1898 for venvNameKey in ["Python2VirtualEnv", "Python3VirtualEnv"]: |
1902 venvName = Preferences.getDebugger(venvNameKey) |
1899 venvName = Preferences.getDebugger(venvNameKey) |
1903 interpreter = e5App().getObject( |
1900 interpreter = e5App().getObject( |
1904 "VirtualEnvManager").getVirtualenvInterpreter(venvName) |
1901 "VirtualEnvManager").getVirtualenvInterpreter(venvName) |