1742 @param fileName name of the Python file containing the info (string) |
1743 @param fileName name of the Python file containing the info (string) |
1743 """ |
1744 """ |
1744 if not fileName: |
1745 if not fileName: |
1745 return |
1746 return |
1746 |
1747 |
1747 try: |
1748 with contextlib.suppress(OSError): |
1748 os.rename(fileName, fileName + ".orig") |
1749 os.rename(fileName, fileName + ".orig") |
1749 except OSError: |
|
1750 pass |
|
1751 try: |
1750 try: |
1752 hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok |
1751 hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok |
1753 hgOut = hgOut.decode() |
1752 hgOut = hgOut.decode() |
1754 except (OSError, subprocess.CalledProcessError): |
1753 except (OSError, subprocess.CalledProcessError): |
1755 hgOut = "" |
1754 hgOut = "" |
2057 with open(os.path.join(cfg["ericDir"], |
2056 with open(os.path.join(cfg["ericDir"], |
2058 installInfoName), "w") as installInfoFile: |
2057 installInfoName), "w") as installInfoFile: |
2059 json.dump(installInfo, installInfoFile, indent=2) |
2058 json.dump(installInfo, installInfoFile, indent=2) |
2060 |
2059 |
2061 # do some cleanup |
2060 # do some cleanup |
2062 try: |
2061 with contextlib.suppress(OSError): |
2063 if installFromSource: |
2062 if installFromSource: |
2064 os.remove(configName) |
2063 os.remove(configName) |
2065 configNameC = configName + 'c' |
2064 configNameC = configName + 'c' |
2066 if os.path.exists(configNameC): |
2065 if os.path.exists(configNameC): |
2067 os.remove(configNameC) |
2066 os.remove(configNameC) |
2068 os.rename(configName + ".orig", configName) |
2067 os.rename(configName + ".orig", configName) |
2069 except OSError: |
2068 with contextlib.suppress(OSError): |
2070 pass |
|
2071 try: |
|
2072 if installFromSource and infoName: |
2069 if installFromSource and infoName: |
2073 os.remove(infoName) |
2070 os.remove(infoName) |
2074 infoNameC = infoName + 'c' |
2071 infoNameC = infoName + 'c' |
2075 if os.path.exists(infoNameC): |
2072 if os.path.exists(infoNameC): |
2076 os.remove(infoNameC) |
2073 os.remove(infoNameC) |
2077 os.rename(infoName + ".orig", infoName) |
2074 os.rename(infoName + ".orig", infoName) |
2078 except OSError: |
|
2079 pass |
|
2080 |
2075 |
2081 print("\nInstallation complete.") |
2076 print("\nInstallation complete.") |
2082 print() |
2077 print() |
2083 |
2078 |
2084 exit(res) |
2079 exit(res) |