scripts/install.py

branch
eric7
changeset 8475
f1f7646e8e24
parent 8458
d3bedd175c99
child 8476
87c0b6e6e118
equal deleted inserted replaced
8473:754a0ff2ceaa 8475:f1f7646e8e24
1756 if not fileName: 1756 if not fileName:
1757 return 1757 return
1758 1758
1759 with contextlib.suppress(OSError): 1759 with contextlib.suppress(OSError):
1760 os.rename(fileName, fileName + ".orig") 1760 os.rename(fileName, fileName + ".orig")
1761 try: 1761 if sys.platform.startswith(("win", "cygwin")):
1762 hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok 1762 localHg = os.path.join(sys.exec_prefix, "Scripts", "hg.exe")
1763 hgOut = hgOut.decode() 1763 else:
1764 except (OSError, subprocess.CalledProcessError): 1764 localHg = os.path.join(sys.exec_prefix, "bin", "hg")
1765 for hg in (localHg, "hg"):
1766 with contextlib.suppress(OSError, subprocess.CalledProcessError):
1767 hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok
1768 hgOut = hgOut.decode()
1769 if hgOut:
1770 break
1771 else:
1765 hgOut = "" 1772 hgOut = ""
1766 if hgOut: 1773 if hgOut:
1767 hgOut = hgOut.strip() 1774 hgOut = hgOut.strip()
1768 if hgOut.endswith("+"): 1775 if hgOut.endswith("+"):
1769 hgOut = hgOut[:-1] 1776 hgOut = hgOut[:-1]

eric ide

mercurial