1449 |
1449 |
1450 try: |
1450 try: |
1451 from PyQt5.QtCore import qVersion |
1451 from PyQt5.QtCore import qVersion |
1452 except ImportError as msg: |
1452 except ImportError as msg: |
1453 installed = not isSudo and pipInstall( |
1453 installed = not isSudo and pipInstall( |
1454 "PyQt5", |
1454 "PyQt5>=5.12.1,<5.15.2", |
1455 "'PyQt5' could not be detected.\nError: {0}".format(msg) |
1455 "'PyQt5' could not be detected.\nError: {0}".format(msg) |
1456 ) |
1456 ) |
1457 if installed: |
1457 if installed: |
1458 # try to import it again |
1458 # try to import it again |
1459 try: |
1459 try: |
1485 # PyQt 5.12 separated QtWebEngine into a separate wheel |
1485 # PyQt 5.12 separated QtWebEngine into a separate wheel |
1486 if isSudo: |
1486 if isSudo: |
1487 print("Optional 'PyQtWebEngine' could not be detected.") |
1487 print("Optional 'PyQtWebEngine' could not be detected.") |
1488 else: |
1488 else: |
1489 pipInstall( |
1489 pipInstall( |
1490 "PyQtWebEngine", |
1490 "PyQtWebEngine>=5.12.1,<5.15.2", |
1491 "Optional 'PyQtWebEngine' could not be detected.\n" |
1491 "Optional 'PyQtWebEngine' could not be detected.\n" |
1492 "Error: {0}".format(msg) |
1492 "Error: {0}".format(msg) |
1493 ) |
1493 ) |
1494 |
1494 |
1495 try: |
1495 try: |
1535 # Tuple with alternatives, flag indicating it's ok to not be |
1535 # Tuple with alternatives, flag indicating it's ok to not be |
1536 # available (e.g. for 32-Bit Windows) |
1536 # available (e.g. for 32-Bit Windows) |
1537 (("PyQt5.QtWebEngineWidgets", ), sys.maxsize <= 2**32), |
1537 (("PyQt5.QtWebEngineWidgets", ), sys.maxsize <= 2**32), |
1538 ] |
1538 ] |
1539 optionalModulesList = {} |
1539 optionalModulesList = {} |
|
1540 # dict with tuples of package name and install constraint |
1540 if sys.platform != "darwin" and not ignorePyqt5Tools: |
1541 if sys.platform != "darwin" and not ignorePyqt5Tools: |
1541 optionalModulesList["qt5-applications"] = "qt5_applications" |
1542 optionalModulesList["qt5-applications"] = ("qt5_applications", |
|
1543 "<5.15.2") |
1542 |
1544 |
1543 # check mandatory modules |
1545 # check mandatory modules |
1544 modulesOK = True |
1546 modulesOK = True |
1545 for impModule in impModulesList: |
1547 for impModule in impModulesList: |
1546 name = impModule.split(".")[1] |
1548 name = impModule.split(".")[1] |
1574 if not altModulesOK: |
1576 if not altModulesOK: |
1575 exit(1) |
1577 exit(1) |
1576 # check optional modules |
1578 # check optional modules |
1577 for optPackage in optionalModulesList: |
1579 for optPackage in optionalModulesList: |
1578 try: |
1580 try: |
1579 __import__(optionalModulesList[optPackage]) |
1581 __import__(optionalModulesList[optPackage][0]) |
1580 print("Found", optPackage) |
1582 print("Found", optPackage) |
1581 except ImportError as msg: |
1583 except ImportError as msg: |
1582 if isSudo: |
1584 if isSudo: |
1583 print("Optional '{0}' could not be detected." |
1585 print("Optional '{0}' could not be detected." |
1584 .format(optPackage)) |
1586 .format(optPackage)) |
1585 else: |
1587 else: |
1586 pipInstall( |
1588 pipInstall( |
1587 optPackage, |
1589 optPackage + optionalModulesList[optPackage][1], |
1588 "Optional '{0}' could not be detected.\n" |
1590 "Optional '{0}' could not be detected.\n" |
1589 "Error: {1}".format(optPackage, msg) |
1591 "Error: {1}".format(optPackage, msg) |
1590 ) |
1592 ) |
1591 |
1593 |
1592 # determine the platform dependent black list |
1594 # determine the platform dependent black list |