eric6/UI/UserInterface.py

changeset 7813
5d0dbec7b815
parent 7809
f5a61d073100
child 7814
6fa40642ed7c
--- a/eric6/UI/UserInterface.py	Sun Oct 25 11:17:02 2020 +0100
+++ b/eric6/UI/UserInterface.py	Sun Oct 25 12:28:07 2020 +0100
@@ -1517,7 +1517,40 @@
                 changed = True
             
             # 2. merge new data into stored file
-            # TODO: merge new data into info file stored in .eric
+            filename = os.path.join(getConfig("ericDir"), "eric6install.json")
+            if os.path.exists(filename):
+                # eric was updated via the install.py script
+                if (
+                    os.path.getmtime(filename) >
+                    os.path.getmtime(installInfoFile)
+                ):
+                    if not installInfo["edited"]:
+                        shutil.copy2(filename, installInfoFile)
+                    else:
+                        with open(filename, "r") as infoFile:
+                            installInfo2 = json.load(infoFile)
+                        if not installInfo["install_cwd_edited"]:
+                            installInfo2["install_cwd"] = installInfo[
+                                "install_cwd"]
+                        if not installInfo["exe_edited"]:
+                            installInfo2["exe"] = installInfo["exe"]
+                        if not installInfo["argv_edited"]:
+                            installInfo2["argv"] = installInfo["argv"]
+                        if not installInfo["eric_edited"]:
+                            installInfo2["eric"] = installInfo["eric"]
+                        installInfo = installInfo2
+                        changed = True
+            else:
+                filename = os.path.join(getConfig("ericDir"),
+                                        "eric6installpip.json")
+                if os.path.exists(filename):
+                    # eric was updated via pip (i.e. eric-ide)
+                    # just update the installation date and time
+                    installDateTime = datetime.datetime.now(tz=None)
+                    installInfo["installed_on"] = installDateTime.strftime(
+                        "%Y-%m-%d %H:%M:%S")
+                    changed = True
+            
             if changed:
                 with open(installInfoFile, "w") as infoFile:
                     json.dump(installInfo, infoFile, indent=2)

eric ide

mercurial