scripts/install.py

branch
eric7
changeset 8966
c6f67dbc6ee7
parent 8918
2167e507b277
child 8977
663521af48b2
--- a/scripts/install.py	Mon Feb 28 17:10:59 2022 +0100
+++ b/scripts/install.py	Mon Feb 28 19:44:36 2022 +0100
@@ -1055,7 +1055,7 @@
                 os.path.join(os.path.dirname(__file__),
                              "create_windows_links.py"),
             ]
-            subprocess.call(args)               # secok
+            subprocess.run(args)                # secok
         else:
             print(
                 "\nThe Python package 'pywin32' is not installed. Desktop and"
@@ -1389,10 +1389,10 @@
               .format(message, packageName), end=" ")
         answer = input()                            # secok
     if answer in ("", "Y", "y"):
-        exitCode = subprocess.call(                 # secok
+        exitCode = subprocess.run(                  # secok
             [sys.executable, "-m", "pip", "install", "--prefer-binary",
              "--upgrade", packageName]
-        )
+        ).returncode
         ok = (exitCode == 0)
     
     return ok
@@ -1406,11 +1406,11 @@
     @rtype bool
     """
     try:
-        pipOut = subprocess.check_output([          # secok
-            sys.executable, "-m", "pip", "list", "--outdated",
-            "--format=json"
-        ])
-        pipOut = pipOut.decode()
+        pipOut = subprocess.run(          # secok
+            [sys.executable, "-m", "pip", "list", "--outdated",
+             "--format=json"],
+            check=True, capture_output=True, text=True
+        ).stdout
     except (OSError, subprocess.CalledProcessError):
         pipOut = "[]"       # default empty list
     try:
@@ -1439,7 +1439,7 @@
         print("Shall 'pip' be updated (recommended)? (Y/n)", end=" ")
         answer = input()            # secok
     if answer in ("", "Y", "y"):
-        subprocess.call(            # secok
+        subprocess.run(             # secok
             [sys.executable, "-m", "pip", "install", "--upgrade", "pip"])
 
 
@@ -1797,8 +1797,10 @@
     )
     for hg in (localHg, "hg"):
         with contextlib.suppress(OSError, subprocess.CalledProcessError):
-            hgOut = subprocess.check_output([hg, "identify", "-i"])   # secok
-            hgOut = hgOut.decode()
+            hgOut = subprocess.run(                     # secok
+                [hg, "identify", "-i"], check=True,
+                capture_output=True, text=True
+            ).stdout
             if hgOut:
                 break
     else:

eric ide

mercurial