scripts/install.py

changeset 7628
f904d0eef264
parent 7584
328d92d8db48
child 7637
c878e8255972
equal deleted inserted replaced
7626:7f643d41464e 7628:f904d0eef264
17 import compileall 17 import compileall
18 import py_compile 18 import py_compile
19 import glob 19 import glob
20 import shutil 20 import shutil
21 import fnmatch 21 import fnmatch
22 import subprocess 22 import subprocess # secok
23 import time 23 import time
24 import io 24 import io
25 import json 25 import json
26 26
27 # Define the globals. 27 # Define the globals.
91 91
92 print() 92 print()
93 93
94 if sys.platform.startswith(("win", "cygwin")): 94 if sys.platform.startswith(("win", "cygwin")):
95 try: 95 try:
96 input("Press enter to continue...") 96 input("Press enter to continue...") # secok
97 except (EOFError, SyntaxError): 97 except (EOFError, SyntaxError):
98 pass 98 pass
99 99
100 os.chdir(currDir) 100 os.chdir(currDir)
101 101
364 '''exec "{0}" "{1}/{2}.py" "$@"\n''' 364 '''exec "{0}" "{1}/{2}.py" "$@"\n'''
365 .format(sys.executable, pydir, wfile)) 365 .format(sys.executable, pydir, wfile))
366 366
367 wname = os.path.join(saveDir, wname) 367 wname = os.path.join(saveDir, wname)
368 copyToFile(wname, wrapper) 368 copyToFile(wname, wrapper)
369 os.chmod(wname, 0o755) 369 os.chmod(wname, 0o755) # secok
370 370
371 return wname 371 return wname
372 372
373 373
374 def copyTree(src, dst, filters, excludeDirs=None, excludePatterns=None): 374 def copyTree(src, dst, filters, excludeDirs=None, excludePatterns=None):
1012 args = [ 1012 args = [
1013 sys.executable, 1013 sys.executable,
1014 os.path.join(os.path.dirname(__file__), 1014 os.path.join(os.path.dirname(__file__),
1015 "create_windows_links.py"), 1015 "create_windows_links.py"),
1016 ] 1016 ]
1017 subprocess.call(args) 1017 subprocess.call(args) # secok
1018 else: 1018 else:
1019 print( 1019 print(
1020 "\nThe Python package 'pywin32' is not installed. Desktop and" 1020 "\nThe Python package 'pywin32' is not installed. Desktop and"
1021 " Start Menu entries will not be created." 1021 " Start Menu entries will not be created."
1022 ) 1022 )
1112 '''{0}''' 1112 '''{0}'''
1113 '''{1}''' 1113 '''{1}'''
1114 '''exec "{2}" "{3}/{4}.py" "$@"\n''' 1114 '''exec "{2}" "{3}/{4}.py" "$@"\n'''
1115 .format(pathLine, dyldLine, starter, pydir, "eric6")) 1115 .format(pathLine, dyldLine, starter, pydir, "eric6"))
1116 copyToFile(wname, wrapper) 1116 copyToFile(wname, wrapper)
1117 os.chmod(wname, 0o755) 1117 os.chmod(wname, 0o755) # secok
1118 1118
1119 shutilCopy(os.path.join(eric6SourceDir, "pixmaps", "eric_2.icns"), 1119 shutilCopy(os.path.join(eric6SourceDir, "pixmaps", "eric_2.icns"),
1120 os.path.join(directories["icns"], "eric.icns")) 1120 os.path.join(directories["icns"], "eric.icns"))
1121 1121
1122 if os.path.exists(os.path.join("eric", "eric6", "UI", "Info.py")): 1122 if os.path.exists(os.path.join("eric", "eric6", "UI", "Info.py")):
1300 if yes2All: 1300 if yes2All:
1301 answer = "y" 1301 answer = "y"
1302 else: 1302 else:
1303 print("{0}\n\nShall '{1}' be installed using pip? (Y/n)" 1303 print("{0}\n\nShall '{1}' be installed using pip? (Y/n)"
1304 .format(message, packageName), end=" ") 1304 .format(message, packageName), end=" ")
1305 answer = input() 1305 answer = input() # secok
1306 if answer in ("", "Y", "y"): 1306 if answer in ("", "Y", "y"):
1307 exitCode = subprocess.call( 1307 exitCode = subprocess.call( # secok
1308 [sys.executable, "-m", "pip", "install", packageName]) 1308 [sys.executable, "-m", "pip", "install", packageName])
1309 ok = (exitCode == 0) 1309 ok = (exitCode == 0)
1310 1310
1311 return ok 1311 return ok
1312 1312
1317 1317
1318 @return flag indicating an outdated pip 1318 @return flag indicating an outdated pip
1319 @rtype bool 1319 @rtype bool
1320 """ 1320 """
1321 try: 1321 try:
1322 pipOut = subprocess.check_output([ 1322 pipOut = subprocess.check_output([ # secok
1323 sys.executable, "-m", "pip", "list", "--outdated", 1323 sys.executable, "-m", "pip", "list", "--outdated",
1324 "--format=json" 1324 "--format=json"
1325 ]) 1325 ])
1326 pipOut = pipOut.decode() 1326 pipOut = pipOut.decode()
1327 except (OSError, subprocess.CalledProcessError): 1327 except (OSError, subprocess.CalledProcessError):
1348 1348
1349 if yes2All: 1349 if yes2All:
1350 answer = "y" 1350 answer = "y"
1351 else: 1351 else:
1352 print("Shall 'pip' be updated (recommended)? (Y/n)", end=" ") 1352 print("Shall 'pip' be updated (recommended)? (Y/n)", end=" ")
1353 answer = input() 1353 answer = input() # secok
1354 if answer in ("", "Y", "y"): 1354 if answer in ("", "Y", "y"):
1355 subprocess.call( 1355 subprocess.call( # secok
1356 [sys.executable, "-m", "pip", "install", "--upgrade", "pip"]) 1356 [sys.executable, "-m", "pip", "install", "--upgrade", "pip"])
1357 1357
1358 1358
1359 def doDependancyChecks(): 1359 def doDependancyChecks():
1360 """ 1360 """
1650 try: 1650 try:
1651 os.rename(fileName, fileName + ".orig") 1651 os.rename(fileName, fileName + ".orig")
1652 except EnvironmentError: 1652 except EnvironmentError:
1653 pass 1653 pass
1654 try: 1654 try:
1655 hgOut = subprocess.check_output(["hg", "identify", "-i"]) 1655 hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok
1656 hgOut = hgOut.decode() 1656 hgOut = hgOut.decode()
1657 except (OSError, subprocess.CalledProcessError): 1657 except (OSError, subprocess.CalledProcessError):
1658 hgOut = "" 1658 hgOut = ""
1659 if hgOut: 1659 if hgOut:
1660 hgOut = hgOut.strip() 1660 hgOut = hgOut.strip()
1836 elif opt == "-z": 1836 elif opt == "-z":
1837 doCompile = False 1837 doCompile = False
1838 elif opt == "-f": 1838 elif opt == "-f":
1839 try: 1839 try:
1840 exec(compile(open(arg).read(), arg, 'exec'), globals()) 1840 exec(compile(open(arg).read(), arg, 'exec'), globals())
1841 # secok
1841 if len(cfg) != configLength: 1842 if len(cfg) != configLength:
1842 print("The configuration dictionary in '{0}' is incorrect." 1843 print("The configuration dictionary in '{0}' is incorrect."
1843 " Aborting".format(arg)) 1844 " Aborting".format(arg))
1844 exit(6) 1845 exit(6)
1845 except Exception: 1846 except Exception:

eric ide

mercurial