Changed the install scripts and the eric7_fido2.py[w] scripts because these scripts need admin rights on Windows. eric7

Sat, 27 Jul 2024 14:22:24 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Jul 2024 14:22:24 +0200
branch
eric7
changeset 10868
ca5cd7faaf5e
parent 10867
75160699ac5a
child 10869
3ea51d5cd462

Changed the install scripts and the eric7_fido2.py[w] scripts because these scripts need admin rights on Windows.

pyproject.toml file | annotate | diff | comparison | revisions
scripts/install-dependencies.py file | annotate | diff | comparison | revisions
scripts/install.py file | annotate | diff | comparison | revisions
src/eric7/eric7_fido2.py file | annotate | diff | comparison | revisions
src/eric7/eric7_fido2.pyw file | annotate | diff | comparison | revisions
--- a/pyproject.toml	Sat Jul 27 12:03:50 2024 +0200
+++ b/pyproject.toml	Sat Jul 27 14:22:24 2024 +0200
@@ -88,6 +88,7 @@
     "psutil",
     "fido2",
     "pywin32>=1.0;platform_system=='Windows'",
+    "command-runner;platform_system=='Windows'",
 ]
 dynamic = ["version"]
 
--- a/scripts/install-dependencies.py	Sat Jul 27 12:03:50 2024 +0200
+++ b/scripts/install-dependencies.py	Sat Jul 27 14:22:24 2024 +0200
@@ -96,6 +96,10 @@
         "esprima",
         "fido2",
     )
+    optionalWindowsPackages = (
+        "pywin32>=1.0",
+        "command-runner",
+    )
 
     if "--proxy" in sys.argv:
         proxyIndex = sys.argv.index("--proxy")
@@ -108,10 +112,14 @@
     if len(sys.argv) == 2:
         if sys.argv[1] == "--all":
             packages = requiredPackages + optionalPackages
+            if sys.platform.startswith(("win", "cygwin")):
+                packages += optionalWindowsPackages
         elif sys.argv[1] == "--required":
             packages = requiredPackages
         elif sys.argv[1] == "--optional":
             packages = optionalPackages
+            if sys.platform.startswith(("win", "cygwin")):
+                packages += optionalWindowsPackages
 
     if not packages:
         print("Usage:")
--- a/scripts/install.py	Sat Jul 27 12:03:50 2024 +0200
+++ b/scripts/install.py	Sat Jul 27 14:22:24 2024 +0200
@@ -12,6 +12,7 @@
 import argparse
 import compileall
 import contextlib
+import copy
 import datetime
 import fnmatch
 import getpass
@@ -1740,6 +1741,12 @@
     }
     if withPyqt6Tools:
         optionalModulesList["qt6-applications"] = ("qt6_applications", "")
+    optionalWinModulesList = {
+        # key is pip project name
+        # value is tuple of package name, pip install constraint
+        "pywin32": ("win32com", ">=1.0"),
+        "command-runner": ("command_runner", ""),
+    }
 
     # check mandatory PyQt6 modules
     modulesOK = True
@@ -1786,9 +1793,12 @@
     print("\nOptional Packages")
     print("-----------------")
     optionalMissing = False
-    for optPackage in sorted(optionalModulesList):
+    optModulesDict = copy.deepcopy(optionalModulesList)
+    if sys.platform.startswith(("win", "cygwin")):
+        optModulesDict.update(optionalWinModulesList)
+    for optPackage in sorted(optModulesDict):
         try:
-            importlib.import_module(optionalModulesList[optPackage][0])
+            importlib.import_module(optModulesDict[optPackage][0])
             print("Found", optPackage)
         except ImportError as err:
             if isSudo:
@@ -1798,7 +1808,7 @@
                 msg = "Optional '{0}' could not be detected.{1}".format(
                     optPackage, "\nError: {0}".format(err) if verbose else ""
                 )
-                pipInstall(optPackage + optionalModulesList[optPackage][1], msg)
+                pipInstall(optPackage + optModulesDict[optPackage][1], msg)
     if optionalMissing:
         print("Some optional packages are missing and could not be installed.")
         print("Install them manually with:")
--- a/src/eric7/eric7_fido2.py	Sat Jul 27 12:03:50 2024 +0200
+++ b/src/eric7/eric7_fido2.py	Sat Jul 27 14:22:24 2024 +0200
@@ -122,4 +122,8 @@
 
 
 if __name__ == "__main__":
-    main()
+    if os.name == "nt":
+        from command_runner.elevate import elevate
+        elevate(main)
+    else:
+        main()
--- a/src/eric7/eric7_fido2.pyw	Sat Jul 27 12:03:50 2024 +0200
+++ b/src/eric7/eric7_fido2.pyw	Sat Jul 27 14:22:24 2024 +0200
@@ -8,6 +8,7 @@
 """
 
 if __name__ == "__main__":
+    from command_runner.elevate import elevate
     from eric7_fido2 import main
 
-    main()
+    elevate(main)

eric ide

mercurial