1369 impModulesList = [ |
1369 impModulesList = [ |
1370 "PyQt5.QtGui", "PyQt5.QtNetwork", "PyQt5.QtPrintSupport", |
1370 "PyQt5.QtGui", "PyQt5.QtNetwork", "PyQt5.QtPrintSupport", |
1371 "PyQt5.QtSql", "PyQt5.QtSvg", "PyQt5.QtWidgets", |
1371 "PyQt5.QtSql", "PyQt5.QtSvg", "PyQt5.QtWidgets", |
1372 ] |
1372 ] |
1373 altModulesList = [ |
1373 altModulesList = [ |
1374 ("PyQt5.QtWebEngineWidgets", "PyQt5.QtWebKitWidgets") |
1374 # Tuple with alternatives, flag indicating it's ok to not be |
|
1375 # available (e.g. for 32-Bit Windows) |
|
1376 (("PyQt5.QtWebEngineWidgets", "PyQt5.QtWebKitWidgets"), |
|
1377 sys.maxsize <= 2**32), |
1375 ] |
1378 ] |
1376 # check mandatory modules |
1379 # check mandatory modules |
1377 modulesOK = True |
1380 modulesOK = True |
1378 for impModule in impModulesList: |
1381 for impModule in impModulesList: |
1379 name = impModule.split(".")[1] |
1382 name = impModule.split(".")[1] |
1387 if not modulesOK: |
1390 if not modulesOK: |
1388 exit(1) |
1391 exit(1) |
1389 # check mandatory modules with alternatives |
1392 # check mandatory modules with alternatives |
1390 if altModulesList: |
1393 if altModulesList: |
1391 altModulesOK = True |
1394 altModulesOK = True |
1392 for altModules in altModulesList: |
1395 for altModules, forcedOk in altModulesList: |
1393 modulesOK = False |
1396 modulesOK = False |
1394 for altModule in altModules: |
1397 for altModule in altModules: |
1395 name = altModule.split(".")[1] |
1398 name = altModule.split(".")[1] |
1396 try: |
1399 try: |
1397 __import__(altModule) |
1400 __import__(altModule) |
1398 print("Found", name) |
1401 print("Found", name) |
1399 modulesOK = True |
1402 modulesOK = True |
1400 break |
1403 break |
1401 except ImportError: |
1404 except ImportError: |
1402 pass |
1405 pass |
1403 if not modulesOK: |
1406 if not modulesOK and not forcedOk: |
1404 altModulesOK = False |
1407 altModulesOK = False |
1405 print('Sorry, please install {0}.' |
1408 print('Sorry, please install {0}.' |
1406 .format(" or ".join(altModules))) |
1409 .format(" or ".join(altModules))) |
1407 if not altModulesOK: |
1410 if not altModulesOK: |
1408 exit(1) |
1411 exit(1) |