10 """ |
10 """ |
11 Installation script for the eric6 debug clients. |
11 Installation script for the eric6 debug clients. |
12 """ |
12 """ |
13 |
13 |
14 from __future__ import unicode_literals, print_function |
14 from __future__ import unicode_literals, print_function |
15 try: |
|
16 import cStringIO as io |
|
17 try: |
|
18 from PyQt5 import sip |
|
19 except ImportError: |
|
20 import sip |
|
21 sip.setapi('QString', 2) |
|
22 sip.setapi('QVariant', 2) |
|
23 sip.setapi('QTextStream', 2) |
|
24 except (ImportError): |
|
25 import io # __IGNORE_WARNING__ |
|
26 |
15 |
27 import sys |
16 import sys |
28 import os |
17 import os |
29 import re |
18 import re |
30 import compileall |
19 import compileall |
31 import shutil |
20 import shutil |
32 import fnmatch |
21 import fnmatch |
|
22 import io |
33 |
23 |
34 # Define the globals. |
24 # Define the globals. |
35 progName = None |
25 progName = None |
36 currDir = os.getcwd() |
26 currDir = os.getcwd() |
37 modDir = None |
27 modDir = None |
51 @param rcode result code to report back (integer) |
41 @param rcode result code to report back (integer) |
52 """ |
42 """ |
53 global currDir |
43 global currDir |
54 |
44 |
55 if sys.platform.startswith("win"): |
45 if sys.platform.startswith("win"): |
56 # different meaning of input between Py2 and Py3 |
|
57 try: |
46 try: |
58 input("Press enter to continue...") |
47 input("Press enter to continue...") |
59 except (EOFError, SyntaxError): |
48 except (EOFError, SyntaxError): |
60 pass |
49 pass |
61 |
50 |
251 |
240 |
252 # Parse the command line. |
241 # Parse the command line. |
253 global progName, modDir, doCleanup, doCompile, distDir |
242 global progName, modDir, doCleanup, doCompile, distDir |
254 global sourceDir |
243 global sourceDir |
255 |
244 |
256 if sys.version_info < (2, 7, 0) or sys.version_info > (3, 9, 9): |
245 if sys.version_info < (3, 5, 0) or sys.version_info > (3, 99, 99): |
257 print('Sorry, eric6 requires at least Python 2.7 or ' |
246 print('Sorry, eric6 requires at least Python 3.5 for running.') |
258 'Python 3 for running.') |
|
259 exit(5) |
247 exit(5) |
260 |
248 |
261 progName = os.path.basename(argv[0]) |
249 progName = os.path.basename(argv[0]) |
262 |
250 |
263 if os.path.dirname(argv[0]): |
251 if os.path.dirname(argv[0]): |
315 exit(7) |
303 exit(7) |
316 |
304 |
317 if doCompile: |
305 if doCompile: |
318 print("\nCompiling source files ...") |
306 print("\nCompiling source files ...") |
319 skipRe = re.compile(r"DebugClients[\\/]Python[\\/]") |
307 skipRe = re.compile(r"DebugClients[\\/]Python[\\/]") |
320 # Hide compile errors (mainly because of Py2/Py3 differences) |
|
321 sys.stdout = io.StringIO() |
308 sys.stdout = io.StringIO() |
322 if distDir: |
309 if distDir: |
323 compileall.compile_dir( |
310 compileall.compile_dir( |
324 os.path.join(eric6SourceDir, "DebugClients"), |
311 os.path.join(eric6SourceDir, "DebugClients"), |
325 ddir=os.path.join(distDir, modDir, installPackage), |
312 ddir=os.path.join(distDir, modDir, installPackage), |