scripts/install.py

branch
maintenance
changeset 8142
43248bafe9b2
parent 8043
0acf98cd089a
parent 8128
8f012c58f27e
child 8273
698ae46f40a4
equal deleted inserted replaced
8044:874fdd14d3a2 8142:43248bafe9b2
774 cfg['ericCSSDir'], 774 cfg['ericCSSDir'],
775 ['*.css']) 775 ['*.css'])
776 copyTree( 776 copyTree(
777 os.path.join(eric6SourceDir, "Styles"), 777 os.path.join(eric6SourceDir, "Styles"),
778 cfg['ericStylesDir'], 778 cfg['ericStylesDir'],
779 ['*.qss', '*.e4h', '*.e6h']) 779 ['*.qss', '*.e4h', '*.e6h', '*.ehj'])
780 copyTree( 780 copyTree(
781 os.path.join(eric6SourceDir, "i18n"), 781 os.path.join(eric6SourceDir, "i18n"),
782 cfg['ericTranslationsDir'], 782 cfg['ericTranslationsDir'],
783 ['*.qm']) 783 ['*.qm'])
784 copyTree( 784 copyTree(
847 shutilCopy(name, cfg['ericDocDir']) 847 shutilCopy(name, cfg['ericDocDir'])
848 except OSError: 848 except OSError:
849 print("Could not install '{0}'.".format(name)) 849 print("Could not install '{0}'.".format(name))
850 850
851 # copy some more stuff 851 # copy some more stuff
852 for name in ['default.e4k', 'default_Mac.e4k']: 852 for name in ('default.ekj', 'default_Mac.ekj',
853 'default.e4k', 'default_Mac.e4k'):
853 try: 854 try:
854 shutilCopy(os.path.join(sourceDir, "others", name), 855 shutilCopy(os.path.join(sourceDir, "others", name),
855 cfg['ericOthersDir']) 856 cfg['ericOthersDir'])
856 except OSError: 857 except OSError:
857 print("Could not install '{0}'.".format( 858 print("Could not install '{0}'.".format(
1448 1449
1449 try: 1450 try:
1450 from PyQt5.QtCore import qVersion 1451 from PyQt5.QtCore import qVersion
1451 except ImportError as msg: 1452 except ImportError as msg:
1452 installed = not isSudo and pipInstall( 1453 installed = not isSudo and pipInstall(
1453 "PyQt5", 1454 "PyQt5>=5.12.1,<5.15.2",
1454 "'PyQt5' could not be detected.\nError: {0}".format(msg) 1455 "'PyQt5' could not be detected.\nError: {0}".format(msg)
1455 ) 1456 )
1456 if installed: 1457 if installed:
1457 # try to import it again 1458 # try to import it again
1458 try: 1459 try:
1484 # PyQt 5.12 separated QtWebEngine into a separate wheel 1485 # PyQt 5.12 separated QtWebEngine into a separate wheel
1485 if isSudo: 1486 if isSudo:
1486 print("Optional 'PyQtWebEngine' could not be detected.") 1487 print("Optional 'PyQtWebEngine' could not be detected.")
1487 else: 1488 else:
1488 pipInstall( 1489 pipInstall(
1489 "PyQtWebEngine", 1490 "PyQtWebEngine>=5.12.1,<5.15.2",
1490 "Optional 'PyQtWebEngine' could not be detected.\n" 1491 "Optional 'PyQtWebEngine' could not be detected.\n"
1491 "Error: {0}".format(msg) 1492 "Error: {0}".format(msg)
1492 ) 1493 )
1493 1494
1494 try: 1495 try:
1496 except ImportError as msg: 1497 except ImportError as msg:
1497 if isSudo: 1498 if isSudo:
1498 print("Optional 'PyQtChart' could not be detected.") 1499 print("Optional 'PyQtChart' could not be detected.")
1499 else: 1500 else:
1500 pipInstall( 1501 pipInstall(
1501 "PyQtChart", 1502 "PyQtChart>=5.12.1,<5.15.2",
1502 "Optional 'PyQtChart' could not be detected.\n" 1503 "Optional 'PyQtChart' could not be detected.\n"
1503 "Error: {0}".format(msg) 1504 "Error: {0}".format(msg)
1504 ) 1505 )
1505 1506
1506 try: 1507 try:
1533 altModulesList = [ 1534 altModulesList = [
1534 # Tuple with alternatives, flag indicating it's ok to not be 1535 # Tuple with alternatives, flag indicating it's ok to not be
1535 # available (e.g. for 32-Bit Windows) 1536 # available (e.g. for 32-Bit Windows)
1536 (("PyQt5.QtWebEngineWidgets", ), sys.maxsize <= 2**32), 1537 (("PyQt5.QtWebEngineWidgets", ), sys.maxsize <= 2**32),
1537 ] 1538 ]
1538 optionalModulesList = {} 1539 optionalModulesList = {
1540 # key is pip project name
1541 # value is tuple of package name, pip install constraint
1542 "PyYAML": ("yaml", ""),
1543 "toml": ("toml", ""),
1544 }
1545 # dict with tuples of package name and install constraint
1539 if sys.platform != "darwin" and not ignorePyqt5Tools: 1546 if sys.platform != "darwin" and not ignorePyqt5Tools:
1540 optionalModulesList["qt5-applications"] = "qt5_applications" 1547 optionalModulesList["qt5-applications"] = ("qt5_applications",
1548 "<5.15.2")
1541 1549
1542 # check mandatory modules 1550 # check mandatory modules
1543 modulesOK = True 1551 modulesOK = True
1544 for impModule in impModulesList: 1552 for impModule in impModulesList:
1545 name = impModule.split(".")[1] 1553 name = impModule.split(".")[1]
1573 if not altModulesOK: 1581 if not altModulesOK:
1574 exit(1) 1582 exit(1)
1575 # check optional modules 1583 # check optional modules
1576 for optPackage in optionalModulesList: 1584 for optPackage in optionalModulesList:
1577 try: 1585 try:
1578 __import__(optionalModulesList[optPackage]) 1586 __import__(optionalModulesList[optPackage][0])
1579 print("Found", optPackage) 1587 print("Found", optPackage)
1580 except ImportError as msg: 1588 except ImportError as msg:
1581 if isSudo: 1589 if isSudo:
1582 print("Optional '{0}' could not be detected." 1590 print("Optional '{0}' could not be detected."
1583 .format(optPackage)) 1591 .format(optPackage))
1584 else: 1592 else:
1585 pipInstall( 1593 pipInstall(
1586 optPackage, 1594 optPackage + optionalModulesList[optPackage][1],
1587 "Optional '{0}' could not be detected.\n" 1595 "Optional '{0}' could not be detected.\n"
1588 "Error: {1}".format(optPackage, msg) 1596 "Error: {1}".format(optPackage, msg)
1589 ) 1597 )
1590 1598
1591 # determine the platform dependent black list 1599 # determine the platform dependent black list

eric ide

mercurial