install.py

branch
5_0_x
changeset 391
68e4164b709d
parent 387
7cb2a400b7a3
child 433
988006cb898f
child 462
ac91c502254e
equal deleted inserted replaced
389:1a8c8424d2b3 391:68e4164b709d
28 apisDir = None 28 apisDir = None
29 doCleanup = True 29 doCleanup = True
30 doCompile = True 30 doCompile = True
31 cfg = {} 31 cfg = {}
32 progLanguages = ["Python", "Ruby"] 32 progLanguages = ["Python", "Ruby"]
33
34 def exit(rcode = 0):
35 """
36 Exit the install script.
37 """
38 if sys.platform.startswith("win"):
39 input("Press enter to continue...")
40
41 sys.exit(rcode)
33 42
34 def usage(rcode = 2): 43 def usage(rcode = 2):
35 """ 44 """
36 Display a usage message and exit. 45 Display a usage message and exit.
37 46
67 print("'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',") 76 print("'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',")
68 print("'ericOthersDir','bindir', 'mdir' and 'apidir.") 77 print("'ericOthersDir','bindir', 'mdir' and 'apidir.")
69 print("These define the directories for the installation of the various parts of"\ 78 print("These define the directories for the installation of the various parts of"\
70 " eric5.") 79 " eric5.")
71 80
72 sys.exit(rcode) 81 exit(rcode)
73 82
74 83
75 def initGlobals(): 84 def initGlobals():
76 """ 85 """
77 Sets the values of globals that need more than a simple assignment. 86 Sets the values of globals that need more than a simple assignment.
364 # create the global plugins directory 373 # create the global plugins directory
365 createGlobalPluginsDir() 374 createGlobalPluginsDir()
366 375
367 except IOError as msg: 376 except IOError as msg:
368 sys.stderr.write('IOError: %s\nTry install as root.\n' % msg) 377 sys.stderr.write('IOError: %s\nTry install as root.\n' % msg)
369 sys.exit(7) 378 exit(7)
370 379
371 except OSError as msg: 380 except OSError as msg:
372 sys.stderr.write('OSError: %s\nTry install with admin rights.\n' % msg) 381 sys.stderr.write('OSError: %s\nTry install with admin rights.\n' % msg)
373 sys.exit(7) 382 exit(7)
374 383
375 # copy some text files to the doc area 384 # copy some text files to the doc area
376 for name in ["LICENSE.GPL3", "THANKS", "changelog"]: 385 for name in ["LICENSE.GPL3", "THANKS", "changelog"]:
377 try: 386 try:
378 shutil.copy('eric%s%s' % (os.sep, name), cfg['ericDocDir']) 387 shutil.copy('eric%s%s' % (os.sep, name), cfg['ericDocDir'])
522 print('Checking dependencies') 531 print('Checking dependencies')
523 532
524 # perform dependency checks 533 # perform dependency checks
525 if sys.version_info < (3, 1, 0): 534 if sys.version_info < (3, 1, 0):
526 print('Sorry, you must have Python 3.1.0 or higher.') 535 print('Sorry, you must have Python 3.1.0 or higher.')
527 sys.exit(5) 536 exit(5)
528 if sys.version_info > (3, 9, 9): 537 if sys.version_info > (3, 9, 9):
529 print('Sorry, eric5 requires Python 3 for running.') 538 print('Sorry, eric5 requires Python 3 for running.')
530 sys.exit(5) 539 exit(5)
531 print("Python Version: %d.%d.%d" % sys.version_info[:3]) 540 print("Python Version: %d.%d.%d" % sys.version_info[:3])
532 541
533 try: 542 try:
534 from PyQt4.QtCore import qVersion 543 from PyQt4.QtCore import qVersion
535 except ImportError as msg: 544 except ImportError as msg:
536 print('Sorry, please install PyQt4.') 545 print('Sorry, please install PyQt4.')
537 print('Error: %s' % msg) 546 print('Error: %s' % msg)
538 sys.exit(1) 547 exit(1)
539 print("Found PyQt") 548 print("Found PyQt")
540 549
541 try: 550 try:
542 from PyQt4 import Qsci 551 from PyQt4 import Qsci
543 except ImportError as msg: 552 except ImportError as msg:
544 print("Sorry, please install QScintilla2 and") 553 print("Sorry, please install QScintilla2 and")
545 print("it's PyQt4 wrapper.") 554 print("it's PyQt4 wrapper.")
546 print('Error: %s' % msg) 555 print('Error: %s' % msg)
547 sys.exit(1) 556 exit(1)
548 print("Found QScintilla2") 557 print("Found QScintilla2")
549 558
550 # check version of Qt 559 # check version of Qt
551 qtMajor = int(qVersion().split('.')[0]) 560 qtMajor = int(qVersion().split('.')[0])
552 qtMinor = int(qVersion().split('.')[1]) 561 qtMinor = int(qVersion().split('.')[1])
553 if qtMajor < 4 or (qtMajor == 4 and qtMinor < 5): 562 if qtMajor < 4 or (qtMajor == 4 and qtMinor < 5):
554 print('Sorry, you must have Qt version 4.5.0 or higher.') 563 print('Sorry, you must have Qt version 4.5.0 or higher.')
555 sys.exit(2) 564 exit(2)
556 print("Qt Version: %s" % qVersion()) 565 print("Qt Version: %s" % qVersion())
557 566
558 #check version of PyQt 567 #check version of PyQt
559 from PyQt4.QtCore import PYQT_VERSION_STR 568 from PyQt4.QtCore import PYQT_VERSION_STR
560 pyqtVersion = PYQT_VERSION_STR 569 pyqtVersion = PYQT_VERSION_STR
567 min = int(min) 576 min = int(min)
568 pat = int(pat) 577 pat = int(pat)
569 if maj < 4 or (maj == 4 and min < 7): 578 if maj < 4 or (maj == 4 and min < 7):
570 print('Sorry, you must have PyQt 4.7.0 or higher or' \ 579 print('Sorry, you must have PyQt 4.7.0 or higher or' \
571 ' a recent snapshot release.') 580 ' a recent snapshot release.')
572 sys.exit(3) 581 exit(3)
573 print("PyQt Version: ", pyqtVersion) 582 print("PyQt Version: ", pyqtVersion)
574 583
575 #check version of QScintilla 584 #check version of QScintilla
576 from PyQt4.Qsci import QSCINTILLA_VERSION_STR 585 from PyQt4.Qsci import QSCINTILLA_VERSION_STR
577 scintillaVersion = QSCINTILLA_VERSION_STR 586 scintillaVersion = QSCINTILLA_VERSION_STR
584 min = int(min) 593 min = int(min)
585 pat = int(pat) 594 pat = int(pat)
586 if maj < 2 or (maj == 2 and min < 4): 595 if maj < 2 or (maj == 2 and min < 4):
587 print('Sorry, you must have QScintilla 2.4.0 or higher or' \ 596 print('Sorry, you must have QScintilla 2.4.0 or higher or' \
588 ' a recent snapshot release.') 597 ' a recent snapshot release.')
589 sys.exit(4) 598 exit(4)
590 print("QScintilla Version: ", QSCINTILLA_VERSION_STR) 599 print("QScintilla Version: ", QSCINTILLA_VERSION_STR)
591 print("All dependencies ok.") 600 print("All dependencies ok.")
592 print() 601 print()
593 602
594 def compileUiFiles(): 603 def compileUiFiles():
722 try: 731 try:
723 exec(compile(open(arg).read(), arg, 'exec'), globals()) 732 exec(compile(open(arg).read(), arg, 'exec'), globals())
724 if len(cfg) != configLength: 733 if len(cfg) != configLength:
725 print("The configuration dictionary in '%s' is incorrect. Aborting"\ 734 print("The configuration dictionary in '%s' is incorrect. Aborting"\
726 % arg) 735 % arg)
727 sys.exit(6) 736 exit(6)
728 except: 737 except:
729 cfg = {} 738 cfg = {}
730 739
731 if len(cfg) == 0: 740 if len(cfg) == 0:
732 createInstallConfig() 741 createInstallConfig()
811 print() 820 print()
812 print("You have to patch PyQt QNetworkAccessManager.") 821 print("You have to patch PyQt QNetworkAccessManager.")
813 print("See the patches directory for details.") 822 print("See the patches directory for details.")
814 823
815 print() 824 print()
816 if sys.platform.startswith("win"): 825 exit()
817 input("Press enter to continue...")
818 826
819 827
820 if __name__ == "__main__": 828 if __name__ == "__main__":
821 try: 829 try:
822 main(sys.argv) 830 main(sys.argv)

eric ide

mercurial