scripts/install.py

branch
maintenance
changeset 7642
72721823d453
parent 7607
dd1054be15aa
parent 7639
422fd05e9c91
child 7737
5371a22cf2aa
equal deleted inserted replaced
7608:f7cb83647621 7642:72721823d453
6 # This is the install script for eric6. 6 # This is the install script for eric6.
7 7
8 """ 8 """
9 Installation script for the eric6 IDE and all eric6 related tools. 9 Installation script for the eric6 IDE and all eric6 related tools.
10 """ 10 """
11
12 from __future__ import print_function
13 11
14 import sys 12 import sys
15 import os 13 import os
16 import re 14 import re
17 import compileall 15 import compileall
18 import py_compile 16 import py_compile
19 import glob 17 import glob
20 import shutil 18 import shutil
21 import fnmatch 19 import fnmatch
22 import subprocess 20 import subprocess # secok
23 import time 21 import time
24 import io 22 import io
25 import json 23 import json
26 24
27 # Define the globals. 25 # Define the globals.
91 89
92 print() 90 print()
93 91
94 if sys.platform.startswith(("win", "cygwin")): 92 if sys.platform.startswith(("win", "cygwin")):
95 try: 93 try:
96 input("Press enter to continue...") 94 input("Press enter to continue...") # secok
97 except (EOFError, SyntaxError): 95 except (EOFError, SyntaxError):
98 pass 96 pass
99 97
100 os.chdir(currDir) 98 os.chdir(currDir)
101 99
364 '''exec "{0}" "{1}/{2}.py" "$@"\n''' 362 '''exec "{0}" "{1}/{2}.py" "$@"\n'''
365 .format(sys.executable, pydir, wfile)) 363 .format(sys.executable, pydir, wfile))
366 364
367 wname = os.path.join(saveDir, wname) 365 wname = os.path.join(saveDir, wname)
368 copyToFile(wname, wrapper) 366 copyToFile(wname, wrapper)
369 os.chmod(wname, 0o755) 367 os.chmod(wname, 0o755) # secok
370 368
371 return wname 369 return wname
372 370
373 371
374 def copyTree(src, dst, filters, excludeDirs=None, excludePatterns=None): 372 def copyTree(src, dst, filters, excludeDirs=None, excludePatterns=None):
1012 args = [ 1010 args = [
1013 sys.executable, 1011 sys.executable,
1014 os.path.join(os.path.dirname(__file__), 1012 os.path.join(os.path.dirname(__file__),
1015 "create_windows_links.py"), 1013 "create_windows_links.py"),
1016 ] 1014 ]
1017 subprocess.call(args) 1015 subprocess.call(args) # secok
1018 else: 1016 else:
1019 print( 1017 print(
1020 "\nThe Python package 'pywin32' is not installed. Desktop and" 1018 "\nThe Python package 'pywin32' is not installed. Desktop and"
1021 " Start Menu entries will not be created." 1019 " Start Menu entries will not be created."
1022 ) 1020 )
1112 '''{0}''' 1110 '''{0}'''
1113 '''{1}''' 1111 '''{1}'''
1114 '''exec "{2}" "{3}/{4}.py" "$@"\n''' 1112 '''exec "{2}" "{3}/{4}.py" "$@"\n'''
1115 .format(pathLine, dyldLine, starter, pydir, "eric6")) 1113 .format(pathLine, dyldLine, starter, pydir, "eric6"))
1116 copyToFile(wname, wrapper) 1114 copyToFile(wname, wrapper)
1117 os.chmod(wname, 0o755) 1115 os.chmod(wname, 0o755) # secok
1118 1116
1119 shutilCopy(os.path.join(eric6SourceDir, "pixmaps", "eric_2.icns"), 1117 shutilCopy(os.path.join(eric6SourceDir, "pixmaps", "eric_2.icns"),
1120 os.path.join(directories["icns"], "eric.icns")) 1118 os.path.join(directories["icns"], "eric.icns"))
1121 1119
1122 if os.path.exists(os.path.join("eric", "eric6", "UI", "Info.py")): 1120 if os.path.exists(os.path.join("eric", "eric6", "UI", "Info.py")):
1300 if yes2All: 1298 if yes2All:
1301 answer = "y" 1299 answer = "y"
1302 else: 1300 else:
1303 print("{0}\n\nShall '{1}' be installed using pip? (Y/n)" 1301 print("{0}\n\nShall '{1}' be installed using pip? (Y/n)"
1304 .format(message, packageName), end=" ") 1302 .format(message, packageName), end=" ")
1305 answer = input() 1303 answer = input() # secok
1306 if answer in ("", "Y", "y"): 1304 if answer in ("", "Y", "y"):
1307 exitCode = subprocess.call( 1305 exitCode = subprocess.call( # secok
1308 [sys.executable, "-m", "pip", "install", packageName]) 1306 [sys.executable, "-m", "pip", "install", packageName])
1309 ok = (exitCode == 0) 1307 ok = (exitCode == 0)
1310 1308
1311 return ok 1309 return ok
1312 1310
1317 1315
1318 @return flag indicating an outdated pip 1316 @return flag indicating an outdated pip
1319 @rtype bool 1317 @rtype bool
1320 """ 1318 """
1321 try: 1319 try:
1322 pipOut = subprocess.check_output([ 1320 pipOut = subprocess.check_output([ # secok
1323 sys.executable, "-m", "pip", "list", "--outdated", 1321 sys.executable, "-m", "pip", "list", "--outdated",
1324 "--format=json" 1322 "--format=json"
1325 ]) 1323 ])
1326 pipOut = pipOut.decode() 1324 pipOut = pipOut.decode()
1327 except (OSError, subprocess.CalledProcessError): 1325 except (OSError, subprocess.CalledProcessError):
1348 1346
1349 if yes2All: 1347 if yes2All:
1350 answer = "y" 1348 answer = "y"
1351 else: 1349 else:
1352 print("Shall 'pip' be updated (recommended)? (Y/n)", end=" ") 1350 print("Shall 'pip' be updated (recommended)? (Y/n)", end=" ")
1353 answer = input() 1351 answer = input() # secok
1354 if answer in ("", "Y", "y"): 1352 if answer in ("", "Y", "y"):
1355 subprocess.call( 1353 subprocess.call( # secok
1356 [sys.executable, "-m", "pip", "install", "--upgrade", "pip"]) 1354 [sys.executable, "-m", "pip", "install", "--upgrade", "pip"])
1357 1355
1358 1356
1359 def doDependancyChecks(): 1357 def doDependancyChecks():
1360 """ 1358 """
1369 1367
1370 # perform dependency checks 1368 # perform dependency checks
1371 print("Python Version: {0:d}.{1:d}.{2:d}".format(*sys.version_info[:3])) 1369 print("Python Version: {0:d}.{1:d}.{2:d}".format(*sys.version_info[:3]))
1372 if sys.version_info < (3, 5, 0): 1370 if sys.version_info < (3, 5, 0):
1373 print('Sorry, you must have Python 3.5.0 or higher.') 1371 print('Sorry, you must have Python 3.5.0 or higher.')
1374 exit(5)
1375 if sys.version_info[0] > 3:
1376 print('Sorry, eric6 requires Python 3 for running.')
1377 exit(5) 1372 exit(5)
1378 1373
1379 try: 1374 try:
1380 import xml.etree # __IGNORE_WARNING__ 1375 import xml.etree # __IGNORE_WARNING__
1381 except ImportError: 1376 except ImportError:
1650 try: 1645 try:
1651 os.rename(fileName, fileName + ".orig") 1646 os.rename(fileName, fileName + ".orig")
1652 except EnvironmentError: 1647 except EnvironmentError:
1653 pass 1648 pass
1654 try: 1649 try:
1655 hgOut = subprocess.check_output(["hg", "identify", "-i"]) 1650 hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok
1656 hgOut = hgOut.decode() 1651 hgOut = hgOut.decode()
1657 except (OSError, subprocess.CalledProcessError): 1652 except (OSError, subprocess.CalledProcessError):
1658 hgOut = "" 1653 hgOut = ""
1659 if hgOut: 1654 if hgOut:
1660 hgOut = hgOut.strip() 1655 hgOut = hgOut.strip()
1836 elif opt == "-z": 1831 elif opt == "-z":
1837 doCompile = False 1832 doCompile = False
1838 elif opt == "-f": 1833 elif opt == "-f":
1839 try: 1834 try:
1840 exec(compile(open(arg).read(), arg, 'exec'), globals()) 1835 exec(compile(open(arg).read(), arg, 'exec'), globals())
1836 # secok
1841 if len(cfg) != configLength: 1837 if len(cfg) != configLength:
1842 print("The configuration dictionary in '{0}' is incorrect." 1838 print("The configuration dictionary in '{0}' is incorrect."
1843 " Aborting".format(arg)) 1839 " Aborting".format(arg))
1844 exit(6) 1840 exit(6)
1845 except Exception: 1841 except Exception:

eric ide

mercurial