Sun, 25 Oct 2020 12:28:07 +0100
Main Window: added code to update the saved install information after an update.
eric6/UI/UserInterface.py | file | annotate | diff | comparison | revisions | |
scripts/install.py | file | annotate | diff | comparison | revisions |
--- 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)
--- a/scripts/install.py Sun Oct 25 11:17:02 2020 +0100 +++ b/scripts/install.py Sun Oct 25 12:28:07 2020 +0100 @@ -56,6 +56,7 @@ installInfoName = "eric6install.json" installInfo = {} +installCwd = "" # Define blacklisted versions of the prerequisites BlackLists = { @@ -1307,7 +1308,7 @@ """ Record information about the way eric6 was installed. """ - global installInfo, cfg + global installInfo, installCwd, cfg installDateTime = datetime.datetime.now(tz=None) try: @@ -1317,7 +1318,7 @@ installInfo["user"] = os.getlogin() installInfo["exe"] = sys.executable installInfo["argv"] = " ".join(shlex.quote(a) for a in sys.argv[:]) - installInfo["install_cwd"] = os.getcwd() + installInfo["install_cwd"] = installCwd installInfo["eric"] = cfg["ericDir"] installInfo["virtualenv"] = installInfo["eric"].startswith( os.path.expanduser("~")) @@ -1864,7 +1865,7 @@ global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir global sourceDir, eric6SourceDir, configName global macAppBundlePath, macAppBundleName, macPythonExe - global installApis, doCleanDesktopLinks, yes2All + global installApis, doCleanDesktopLinks, yes2All, installCwd if sys.version_info < (3, 5, 0) or sys.version_info > (3, 99, 99): print('Sorry, eric6 requires at least Python 3.5 for running.') @@ -1872,6 +1873,8 @@ progName = os.path.basename(argv[0]) + installCwd = os.getcwd() + if os.path.dirname(argv[0]): os.chdir(os.path.dirname(argv[0]))