diff -r 31d56b9bc7bd -r 44004f273a7b scripts/install.py --- a/scripts/install.py Sat Oct 24 11:44:39 2020 +0200 +++ b/scripts/install.py Sun Oct 25 11:17:02 2020 +0100 @@ -1410,10 +1410,15 @@ """ Perform some dependency checks. """ + try: + isSudo = os.getuid() == 0 + except AttributeError: + isSudo = False + print('Checking dependencies') # update pip first even if we don't need to install anything - if isPipOutdated(): + if not isSudo and isPipOutdated(): updatePip() print("\n") @@ -1433,7 +1438,7 @@ try: from PyQt5.QtCore import qVersion except ImportError as msg: - installed = pipInstall( + installed = not isSudo and pipInstall( "PyQt5", "'PyQt5' could not be detected.\nError: {0}".format(msg) ) @@ -1466,25 +1471,31 @@ from PyQt5.QtCore import PYQT_VERSION if PYQT_VERSION >= 0x050c00: # PyQt 5.12 separated QtWebEngine into a separate wheel - installed = pipInstall( - "PyQtWebEngine", - "Optional 'PyQtWebEngine' could not be detected.\nError: {0}" - .format(msg) - ) + if isSudo: + print("Optional 'PyQtWebEngine' could not be detected.") + else: + pipInstall( + "PyQtWebEngine", + "Optional 'PyQtWebEngine' could not be detected.\n" + "Error: {0}".format(msg) + ) try: from PyQt5 import QtChart # __IGNORE_WARNING__ except ImportError as msg: - installed = pipInstall( - "PyQtChart", - "Optional 'PyQtChart' could not be detected.\nError: {0}" - .format(msg) - ) + if isSudo: + print("Optional 'PyQtChart' could not be detected.") + else: + pipInstall( + "PyQtChart", + "Optional 'PyQtChart' could not be detected.\n" + "Error: {0}".format(msg) + ) try: from PyQt5 import Qsci # __IGNORE_WARNING__ except ImportError as msg: - installed = pipInstall( + installed = not isSudo and pipInstall( "QScintilla", "'QScintilla' could not be detected.\nError: {0}".format(msg) ) @@ -1556,11 +1567,15 @@ __import__(optionalModulesList[optPackage]) print("Found", optPackage) except ImportError as msg: - installed = pipInstall( - optPackage, - "Optional '{0}' could not be detected.\nError: {1}" - .format(optPackage, msg) - ) + if isSudo: + print("Optional '{0}' could not be detected." + .format(optPackage)) + else: + pipInstall( + optPackage, + "Optional '{0}' could not be detected.\n" + "Error: {1}".format(optPackage, msg) + ) # determine the platform dependent black list if sys.platform.startswith(("win", "cygwin")):