install.py

branch
Py2 comp.
changeset 2846
b852fe4d153a
parent 2791
a9577f248f04
child 3057
10516539f238
equal deleted inserted replaced
2791:a9577f248f04 2846:b852fe4d153a
10 """ 10 """
11 11
12 from __future__ import unicode_literals # __IGNORE_WARNING__ 12 from __future__ import unicode_literals # __IGNORE_WARNING__
13 from __future__ import print_function # __IGNORE_WARNING__ 13 from __future__ import print_function # __IGNORE_WARNING__
14 try: 14 try:
15 import cStringIO as io
16 import sip
17 sip.setapi('QString', 2)
18 sip.setapi('QVariant', 2)
19 sip.setapi('QTextStream', 2)
20 except (ImportError):
15 import io 21 import io
16 except (ImportError):
17 import StringIO as io
18 22
19 import sys 23 import sys
20 import os 24 import os
21 import re 25 import re
22 import compileall 26 import compileall
183 187
184 @param name the name of the file. 188 @param name the name of the file.
185 @param text the contents to copy to the file. 189 @param text the contents to copy to the file.
186 """ 190 """
187 f = open(name, "w") 191 f = open(name, "w")
188 f.write(codecs.encode(text, "utf-8")) 192 if sys.version_info[0] == 2:
193 text = codecs.encode(text, "utf-8")
194 f.write(text)
189 f.close() 195 f.close()
190 196
191 197
192 def wrapperName(dname, wfile): 198 def wrapperName(dname, wfile):
193 """ 199 """
792 798
793 # perform dependency checks 799 # perform dependency checks
794 if sys.version_info < (2, 6, 0): 800 if sys.version_info < (2, 6, 0):
795 print('Sorry, you must have Python 2.6.0 or higher or Python 3.1.0 or higher.') 801 print('Sorry, you must have Python 2.6.0 or higher or Python 3.1.0 or higher.')
796 exit(5) 802 exit(5)
797 elif sys.version_info < (3, 1, 0): 803 elif sys.version_info < (3, 1, 0) and sys.version_info[0] == 3:
798 print('Sorry, you must have Python 3.1.0 or higher.') 804 print('Sorry, you must have Python 3.1.0 or higher.')
799 exit(5) 805 exit(5)
800 if sys.version_info > (3, 9, 9): 806 if sys.version_info > (3, 9, 9):
801 print('Sorry, eric5 requires Python 3 for running.') 807 print('Sorry, eric5 requires Python 3 for running.')
802 exit(5) 808 exit(5)
1022 1028
1023 # Parse the command line. 1029 # Parse the command line.
1024 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir 1030 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir
1025 global sourceDir, configName, macAppBundleName, macPythonExe 1031 global sourceDir, configName, macAppBundleName, macPythonExe
1026 1032
1027 if sys.version_info > (3, 9, 9) or sys.version_info < (3, 0, 0): 1033 if sys.version_info < (2, 6, 0) or sys.version_info > (3, 9, 9):
1028 print('Sorry, eric5 requires Python 3 for running.') 1034 print('Sorry, eric5 requires at least Python 2.6 or Python 3 for running.')
1029 exit(5) 1035 exit(5)
1030 1036
1031 progName = os.path.basename(argv[0]) 1037 progName = os.path.basename(argv[0])
1032 1038
1033 if os.path.dirname(argv[0]): 1039 if os.path.dirname(argv[0]):

eric ide

mercurial