scripts/install.py

branch
eric7
changeset 8475
f1f7646e8e24
parent 8458
d3bedd175c99
child 8476
87c0b6e6e118
--- a/scripts/install.py	Sun Jul 18 14:28:27 2021 +0200
+++ b/scripts/install.py	Sun Jul 25 12:26:07 2021 +0200
@@ -1758,10 +1758,17 @@
     
     with contextlib.suppress(OSError):
         os.rename(fileName, fileName + ".orig")
-    try:
-        hgOut = subprocess.check_output(["hg", "identify", "-i"])   # secok
-        hgOut = hgOut.decode()
-    except (OSError, subprocess.CalledProcessError):
+    if sys.platform.startswith(("win", "cygwin")):
+        localHg = os.path.join(sys.exec_prefix, "Scripts", "hg.exe")
+    else:
+        localHg = os.path.join(sys.exec_prefix, "bin", "hg")
+    for hg in (localHg, "hg"):
+        with contextlib.suppress(OSError, subprocess.CalledProcessError):
+            hgOut = subprocess.check_output(["hg", "identify", "-i"])   # secok
+            hgOut = hgOut.decode()
+            if hgOut:
+                break
+    else:
         hgOut = ""
     if hgOut:
         hgOut = hgOut.strip()

eric ide

mercurial