1477 altModulesList = [ |
1477 altModulesList = [ |
1478 # Tuple with alternatives, flag indicating it's ok to not be |
1478 # Tuple with alternatives, flag indicating it's ok to not be |
1479 # available (e.g. for 32-Bit Windows) |
1479 # available (e.g. for 32-Bit Windows) |
1480 (("PyQt5.QtWebEngineWidgets", ), sys.maxsize <= 2**32), |
1480 (("PyQt5.QtWebEngineWidgets", ), sys.maxsize <= 2**32), |
1481 ] |
1481 ] |
|
1482 optionalModulesList = { |
|
1483 "pyqt5-tools": "pyqt5_tools", |
|
1484 } |
1482 # check mandatory modules |
1485 # check mandatory modules |
1483 modulesOK = True |
1486 modulesOK = True |
1484 for impModule in impModulesList: |
1487 for impModule in impModulesList: |
1485 name = impModule.split(".")[1] |
1488 name = impModule.split(".")[1] |
1486 try: |
1489 try: |
1510 altModulesOK = False |
1513 altModulesOK = False |
1511 print('Sorry, please install {0}.' |
1514 print('Sorry, please install {0}.' |
1512 .format(" or ".join(altModules))) |
1515 .format(" or ".join(altModules))) |
1513 if not altModulesOK: |
1516 if not altModulesOK: |
1514 exit(1) |
1517 exit(1) |
|
1518 # check optional modules |
|
1519 for optPackage in optionalModulesList: |
|
1520 try: |
|
1521 __import__(optionalModulesList[optPackage]) |
|
1522 print("Found", optPackage) |
|
1523 except ImportError as msg: |
|
1524 installed = pipInstall( |
|
1525 optPackage, |
|
1526 "Optional '{0}' could not be detected.\nError: {1}" |
|
1527 .format(optPackage, msg) |
|
1528 ) |
1515 |
1529 |
1516 # determine the platform dependent black list |
1530 # determine the platform dependent black list |
1517 if sys.platform.startswith(("win", "cygwin")): |
1531 if sys.platform.startswith(("win", "cygwin")): |
1518 PlatformBlackLists = PlatformsBlackLists["windows"] |
1532 PlatformBlackLists = PlatformsBlackLists["windows"] |
1519 elif sys.platform.startswith("linux"): |
1533 elif sys.platform.startswith("linux"): |