install.py

changeset 2383
e999256385bd
parent 2312
976dcb82c3e9
child 2411
aec0a8a6e548
child 2422
21509a6de6e0
equal deleted inserted replaced
2382:a55e5e94a87b 2383:e999256385bd
320 global pyModDir, progLanguages 320 global pyModDir, progLanguages
321 321
322 # Remove the menu entry for Linux systems 322 # Remove the menu entry for Linux systems
323 if sys.platform.startswith("linux"): 323 if sys.platform.startswith("linux"):
324 for name in ["/usr/share/pixmaps/eric.png", 324 for name in ["/usr/share/pixmaps/eric.png",
325 "/usr/share/applications/eric5.desktop"]: 325 "/usr/share/applications/eric5.desktop",
326 "/usr/share/pixmaps/ericWeb.png",
327 "/usr/share/applications/eric5_webbrowser.desktop"]:
326 if os.path.exists(name): 328 if os.path.exists(name):
327 os.remove(name) 329 os.remove(name)
328 330
329 # Remove the wrapper scripts 331 # Remove the wrapper scripts
330 rem_wnames = [ 332 rem_wnames = [
425 427
426 428
427 def installEric(): 429 def installEric():
428 """ 430 """
429 Actually perform the installation steps. 431 Actually perform the installation steps.
432
433 @return result code (integer)
430 """ 434 """
431 global distDir, doCleanup, cfg, progLanguages, sourceDir, configName 435 global distDir, doCleanup, cfg, progLanguages, sourceDir, configName
432 436
433 # Create the platform specific wrappers. 437 # Create the platform specific wrappers.
434 wnames = [] 438 wnames = []
518 # create the global plugins directory 522 # create the global plugins directory
519 createGlobalPluginsDir() 523 createGlobalPluginsDir()
520 524
521 except IOError as msg: 525 except IOError as msg:
522 sys.stderr.write('IOError: {0}\nTry install with admin rights.\n'.format(msg)) 526 sys.stderr.write('IOError: {0}\nTry install with admin rights.\n'.format(msg))
523 exit(7) 527 return(7)
524 528
525 except OSError as msg: 529 except OSError as msg:
526 sys.stderr.write('OSError: {0}\nTry install with admin rights.\n'.format(msg)) 530 sys.stderr.write('OSError: {0}\nTry install with admin rights.\n'.format(msg))
527 exit(7) 531 return(7)
528 532
529 # copy some text files to the doc area 533 # copy some text files to the doc area
530 for name in ["LICENSE.GPL3", "THANKS", "changelog"]: 534 for name in ["LICENSE.GPL3", "THANKS", "changelog"]:
531 try: 535 try:
532 shutilCopy('{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericDocDir']) 536 shutilCopy('{2}{0}{1}'.format(os.sep, name, sourceDir), cfg['ericDocDir'])
577 if sys.platform.startswith("linux"): 581 if sys.platform.startswith("linux"):
578 if distDir: 582 if distDir:
579 dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps")) 583 dst = os.path.normpath(os.path.join(distDir, "usr/share/pixmaps"))
580 if not os.path.exists(dst): 584 if not os.path.exists(dst):
581 os.makedirs(dst) 585 os.makedirs(dst)
582 shutilCopy(os.path.join(sourceDir, "icons", "default", "eric_2.png"), 586 shutilCopy(os.path.join(sourceDir, "icons", "default", "eric.png"),
583 os.path.join(dst, "eric.png")) 587 os.path.join(dst, "eric.png"))
584 dst = os.path.normpath(os.path.join(distDir, "usr/share/applications")) 588 dst = os.path.normpath(os.path.join(distDir, "usr/share/applications"))
585 if not os.path.exists(dst): 589 if not os.path.exists(dst):
586 os.makedirs(dst) 590 os.makedirs(dst)
587 shutilCopy(os.path.join(sourceDir, "eric5.desktop"), dst) 591 shutilCopy(os.path.join(sourceDir, "eric5.desktop"), dst)
588 else: 592 else:
589 shutilCopy(os.path.join(sourceDir, "icons", "default", "eric_2.png"), 593 shutilCopy(os.path.join(sourceDir, "icons", "default", "eric.png"),
590 "/usr/share/pixmaps/eric.png") 594 "/usr/share/pixmaps/eric.png")
591 shutilCopy(os.path.join(sourceDir, "eric5.desktop"), 595 shutilCopy(os.path.join(sourceDir, "eric5.desktop"),
592 "/usr/share/applications") 596 "/usr/share/applications")
597 shutilCopy(os.path.join(sourceDir, "icons", "default", "ericWeb48.png"),
598 "/usr/share/pixmaps/ericWeb.png")
599 shutilCopy(os.path.join(sourceDir, "eric5_webbrowser.desktop"),
600 "/usr/share/applications")
593 601
594 # Create a Mac application bundle 602 # Create a Mac application bundle
595 if sys.platform == "darwin": 603 if sys.platform == "darwin":
596 createMacAppBundle(cfg['ericDir']) 604 createMacAppBundle(cfg['ericDir'])
605
606 return 0
597 607
598 608
599 def createMacAppBundle(pydir): 609 def createMacAppBundle(pydir):
600 """ 610 """
601 Create a Mac application bundle. 611 Create a Mac application bundle.
1117 rx=re.compile(r"DebugClients[\\/]Python[\\/]|UtilitiesPython2[\\/]"), 1127 rx=re.compile(r"DebugClients[\\/]Python[\\/]|UtilitiesPython2[\\/]"),
1118 quiet=True) 1128 quiet=True)
1119 py_compile.compile(configName, 1129 py_compile.compile(configName,
1120 dfile=os.path.join(modDir, "eric5config.py")) 1130 dfile=os.path.join(modDir, "eric5config.py"))
1121 print("\nInstalling eric5 ...") 1131 print("\nInstalling eric5 ...")
1122 installEric() 1132 res = installEric()
1123 1133
1124 # do some cleanup 1134 # do some cleanup
1125 try: 1135 try:
1126 if installFromSource: 1136 if installFromSource:
1127 os.remove(configName) 1137 os.remove(configName)
1133 pass 1143 pass
1134 1144
1135 print("\nInstallation complete.") 1145 print("\nInstallation complete.")
1136 print() 1146 print()
1137 1147
1138 exit() 1148 exit(res)
1139 1149
1140 1150
1141 if __name__ == "__main__": 1151 if __name__ == "__main__":
1142 try: 1152 try:
1143 main(sys.argv) 1153 main(sys.argv)

eric ide

mercurial