scripts/install.py

branch
eric7-maintenance
changeset 9725
b9a29a7aa820
parent 9654
7328efba128b
parent 9717
02544efa689b
child 9832
3885b9d7bd31
diff -r 1f0497e16118 -r b9a29a7aa820 scripts/install.py
--- a/scripts/install.py	Tue Jan 03 17:01:19 2023 +0100
+++ b/scripts/install.py	Tue Jan 24 10:15:12 2023 +0100
@@ -878,7 +878,7 @@
         shutil.rmtree(scriptsDir)
 
         # copy the license file
-        shutilCopy(os.path.join(sourceDir, "docs", "LICENSE.GPL3"), cfg["ericDir"])
+        shutilCopy(os.path.join(sourceDir, "docs", "LICENSE.txt"), cfg["ericDir"])
 
         # create the global plugins directory
         createGlobalPluginsDir()
@@ -888,18 +888,20 @@
         return 7
 
     # copy some text files to the doc area
-    for name in ["LICENSE.GPL3", "THANKS", "changelog.md", "ThirdParty.rst"]:
+    for name in ["LICENSE.txt", "THANKS", "changelog.md", "ThirdParty.md"]:
         try:
             shutilCopy(os.path.join(sourceDir, "docs", name), cfg["ericDocDir"])
         except OSError:
             print(
-                "Could not install '{0}'.".format(os.path.join(sourceDir, "docs", name))
+                "\nCould not install '{0}'.".format(
+                    os.path.join(sourceDir, "docs", name)
+                )
             )
     for name in glob.glob(os.path.join(sourceDir, "docs", "README*.*")):
         try:
             shutilCopy(name, cfg["ericDocDir"])
         except OSError:
-            print("Could not install '{0}'.".format(name))
+            print("\nCould not install '{0}'.".format(name))
 
     # copy some more stuff
     for name in ("default.ekj", "default_Mac.ekj", "default.e4k", "default_Mac.e4k"):
@@ -907,7 +909,7 @@
             shutilCopy(os.path.join(sourceDir, "others", name), cfg["ericOthersDir"])
         except OSError:
             print(
-                "Could not install '{0}'.".format(
+                "\nCould not install '{0}'.".format(
                     os.path.join(sourceDir, "others", name)
                 )
             )
@@ -917,7 +919,9 @@
         if os.access(cfg["apidir"], os.W_OK):
             for progLanguage in progLanguages:
                 apidir = os.path.join(cfg["apidir"], progLanguage)
-                print("Installing {0} API files to '{1}'.".format(progLanguage, apidir))
+                print(
+                    "\nInstalling {0} API files to '{1}'.".format(progLanguage, apidir)
+                )
                 if not os.path.exists(apidir):
                     os.makedirs(apidir)
                 for apiName in glob.glob(
@@ -929,7 +933,7 @@
                 ):
                     shutilCopy(apiName, apidir)
         else:
-            print("The API directory '{0}' is not writable.".format(cfg["apidir"]))
+            print("\nThe API directory '{0}' is not writable.".format(cfg["apidir"]))
             print("Use the API files provided by the 'API Files' plug-in.")
 
     # Create menu entry for Linux systems
@@ -1582,6 +1586,8 @@
         print("Please install it and try again.")
         exit(5)
 
+    print("PyQt & Qt")
+    print("---------")
     try:
         from PyQt6.QtCore import qVersion
     except ImportError as err:
@@ -1630,6 +1636,7 @@
                 ),
                 msg,
             )
+    print("Found PyQt6-WebEngine")
 
     try:
         from PyQt6 import QtCharts  # __IGNORE_WARNING__
@@ -1701,6 +1708,7 @@
         "trove-classifiers": ("trove_classifiers", ""),
         "black": ("black", ">=22.6.0"),
         "isort": ("isort", ">=5.10.0"),
+        "coverage": ("coverage", ">=6.5.0"),
     }
     optionalModulesList = {
         # key is pip project name
@@ -1717,7 +1725,7 @@
 
     # check mandatory PyQt6 modules
     modulesOK = True
-    for pyqt6BaseModule in pyqt6BaseModulesList:
+    for pyqt6BaseModule in sorted(pyqt6BaseModulesList):
         name = pyqt6BaseModule.split(".")[1]
         try:
             importlib.import_module(pyqt6BaseModule)
@@ -1731,8 +1739,10 @@
         exit(1)
 
     # check required modules
+    print("\nRequired Packages")
+    print("-----------------")
     requiredMissing = False
-    for requiredPackage in requiredModulesList:
+    for requiredPackage in sorted(requiredModulesList):
         try:
             importlib.import_module(requiredModulesList[requiredPackage][0])
             print("Found", requiredPackage)
@@ -1755,8 +1765,10 @@
         print("    {0} install-dependencies.py --required".format(sys.executable))
 
     # check optional modules
+    print("\nOptional Packages")
+    print("-----------------")
     optionalMissing = False
-    for optPackage in optionalModulesList:
+    for optPackage in sorted(optionalModulesList):
         try:
             importlib.import_module(optionalModulesList[optPackage][0])
             print("Found", optPackage)
@@ -2160,7 +2172,13 @@
                             " incorrect. Aborting".format(arg)
                         )
                         exit(6)
-                except Exception:
+                except Exception as exc:
+                    print(
+                        "The configuration file '{0}' is not valid Python source."
+                        " It will be ignored. Installation will be performed with"
+                        " defaults.".format(arg)
+                    )
+                    print("ERROR: {0}".format(str(exc)))
                     cfg = {}
         elif opt == "-m":
             macAppBundleName = arg
@@ -2199,9 +2217,9 @@
 
     # cleanup source if installing from source
     if installFromSource:
-        print("Cleaning up source ...")
+        print("Cleaning up source ...", end="", flush=True)
         cleanupSource(sourceDir)
-        print()
+        print(" Done")
 
         configName = os.path.join(eric7SourceDir, "eric7config.py")
         if os.path.exists(os.path.join(sourceDir, ".hg")):
@@ -2222,7 +2240,7 @@
         os.remove(configName)
 
     # cleanup old installation
-    print("Cleaning up old installation ...")
+    print("Cleaning up old installation ...", end="", flush=True)
     try:
         if doCleanup:
             if distDir:
@@ -2230,26 +2248,32 @@
             else:
                 cleanUp()
     except OSError as msg:
-        sys.stderr.write("Error: {0}\nTry install as root.\n".format(msg))
+        sys.stderr.write("\nError: {0}\nTry install as root.\n".format(msg))
         exit(7)
+    print(" Done")
 
     # Create a config file and delete the default one
-    print("\nCreating configuration file ...")
+    print("Creating configuration file ...", end="", flush=True)
     createConfig()
+    print(" Done")
 
+    # Create an install info file
+    print("Creating an install info file ...", end="", flush=True)
     createInstallInfo()
+    print(" Done")
 
     # Compile .ui files
-    print("\nCompiling user interface files ...")
+    print("Compiling user interface files ...", end="", flush=True)
     # step 1: remove old Ui_*.py files
     for root, _, files in os.walk(sourceDir):
         for file in [f for f in files if fnmatch.fnmatch(f, "Ui_*.py")]:
             os.remove(os.path.join(root, file))
     # step 2: compile the forms
     compileUiFiles()
+    print(" Done")
 
     if doCompile:
-        print("\nCompiling source files ...")
+        print("Compiling source files ...", end="", flush=True)
         skipRe = re.compile(r"DebugClients[\\/]Python[\\/]")
         sys.stdout = io.StringIO()
         if distDir:
@@ -2271,8 +2295,11 @@
             )
             py_compile.compile(configName, dfile=os.path.join(modDir, "eric7config.py"))
         sys.stdout = sys.__stdout__
-    print("\nInstalling eric ...")
+        print(" Done")
+
+    print("Installing eric ...", end="", flush=True)
     res = installEric()
+    print(" Done")
 
     if createInstallInfoFile:
         with open(

eric ide

mercurial