scripts/install.py

branch
maintenance
changeset 7345
bc0ee7fadd03
parent 7322
cd8ee889589f
parent 7333
8479201bdf7b
child 7362
028bf21bb5a2
--- a/scripts/install.py	Fri Nov 01 16:11:55 2019 +0100
+++ b/scripts/install.py	Sun Dec 01 16:38:47 2019 +0100
@@ -37,6 +37,7 @@
 doCleanDesktopLinks = False
 forceCleanDesktopLinks = False
 doCompile = True
+yes2All = False
 cfg = {}
 progLanguages = ["Python", "Ruby", "QSS"]
 sourceDir = "eric"
@@ -110,16 +111,16 @@
     print()
     print("Usage:")
     if sys.platform == "darwin":
-        print("    {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
-              " [-m name] [-n path] [-p python] [--no-apis]"
+        print("    {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
+              " [-m name] [-n path] [-p python] [--no-apis] [--yes]"
               .format(progName))
     elif sys.platform.startswith(("win", "cygwin")):
-        print("    {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file]"
-              " [--clean-desktop] [--no-apis]"
+        print("    {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file]"
+              " [--clean-desktop] [--no-apis] [--yes]"
               .format(progName))
     else:
-        print("    {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
-              " [--no-apis]"
+        print("    {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
+              " [--no-apis] [--yes]"
               .format(progName))
     print("where:")
     print("    -h, --help display this help message")
@@ -152,6 +153,7 @@
     print("    -x         don't perform dependency checks (use on your own"
           " risk)")
     print("    -z         don't compile the installed python files")
+    print("    --yes      answer 'yes' to all questions")
     print()
     print("The file given to the -f option must be valid Python code"
           " defining a")
@@ -1288,10 +1290,15 @@
     @return flag indicating a successful installation
     @rtype bool
     """
+    global yes2All
+    
     ok = False
-    print("{0}\n\nShall '{1}' be installed using pip? (Y/n)"
-          .format(message, packageName), end=" ")
-    answer = input()
+    if yes2All:
+        answer = "y"
+    else:
+        print("{0}\n\nShall '{1}' be installed using pip? (Y/n)"
+              .format(message, packageName), end=" ")
+        answer = input()
     if answer in ("", "Y", "y"):
         exitCode = subprocess.call(
             [sys.executable, "-m", "pip", "install", packageName])
@@ -1542,6 +1549,17 @@
                 print('Please install another version.')
                 exit(5)
     
+    # print version info for additional modules
+    try:
+        print("PyQtChart:", QtChart.PYQT_CHART_VERSION_STR)
+    except (NameError, AttributeError):
+        pass
+    try:
+        from PyQt5 import QtWebEngine
+        print("PyQtWebEngine.", QtWebEngine.PYQT_WEBENGINE_VERSION_STR)
+    except (ImportError, AttributeError):
+        pass
+    
     print("All dependencies ok.")
     print()
 
@@ -1712,7 +1730,7 @@
     global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir
     global sourceDir, eric6SourceDir, configName
     global macAppBundlePath, macAppBundleName, macPythonExe
-    global installApis, doCleanDesktopLinks
+    global installApis, doCleanDesktopLinks, yes2All
     
     if sys.version_info < (3, 5, 0) or sys.version_info > (3, 99, 99):
         print('Sorry, eric6 requires at least Python 3.5 for running.')
@@ -1729,15 +1747,15 @@
         if sys.platform.startswith(("win", "cygwin")):
             optlist, args = getopt.getopt(
                 argv[1:], "chxza:b:d:f:",
-                ["help", "no-apis"])
+                ["help", "no-apis", "yes"])
         elif sys.platform == "darwin":
             optlist, args = getopt.getopt(
                 argv[1:], "chxza:b:d:f:i:m:n:p:",
-                ["help", "no-apis"])
+                ["help", "no-apis", "yes"])
         else:
             optlist, args = getopt.getopt(
                 argv[1:], "chxza:b:d:f:i:",
-                ["help", "no-apis"])
+                ["help", "no-apis", "yes"])
     except getopt.GetoptError as err:
         print(err)
         usage()
@@ -1782,6 +1800,8 @@
             installApis = False
         elif opt == "--clean-desktop":
             doCleanDesktopLinks = True
+        elif opt == "--yes":
+            yes2All = True
     
     infoName = ""
     installFromSource = not os.path.isdir(sourceDir)

eric ide

mercurial