Install Info: added the installation date and time to the install info structure.

Wed, 21 Oct 2020 20:00:57 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 21 Oct 2020 20:00:57 +0200
changeset 7807
5514ca6a62ca
parent 7806
b346755b09a1
child 7808
da107cd00f63

Install Info: added the installation date and time to the install info structure.

eric6/UI/InstallInfoDialog.py file | annotate | diff | comparison | revisions
eric6/UI/UserInterface.py file | annotate | diff | comparison | revisions
scripts/install.py file | annotate | diff | comparison | revisions
setup.py file | annotate | diff | comparison | revisions
--- a/eric6/UI/InstallInfoDialog.py	Mon Oct 19 20:02:01 2020 +0200
+++ b/eric6/UI/InstallInfoDialog.py	Wed Oct 21 20:00:57 2020 +0200
@@ -17,6 +17,7 @@
 import UI.PixmapCache
 
 
+# TODO: add install date output
 class InstallInfoDialog(QDialog, Ui_InstallInfoDialog):
     """
     Class documentation goes here.
--- a/eric6/UI/UserInterface.py	Mon Oct 19 20:02:01 2020 +0200
+++ b/eric6/UI/UserInterface.py	Wed Oct 21 20:00:57 2020 +0200
@@ -12,6 +12,7 @@
 import logging
 import shutil
 import json
+import datetime
 
 from PyQt5.QtCore import (
     pyqtSlot, QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate,
@@ -1478,6 +1479,7 @@
                 if os.path.exists(filename):
                     # eric was installed via pip (i.e. eric-ide)
                     try:
+                        installDateTime = datetime.datetime.now(tz=None)
                         with open(filename, "r") as infoFile:
                             installInfo = json.load(infoFile)
                         installInfo["guessed"] = True
@@ -1490,6 +1492,8 @@
                             installInfo["user"] = os.getlogin()
                             installInfo["exe"] = sys.executable
                         installInfo["installed"] = True
+                        installInfo["installed_on"] = installDateTime.strftime(
+                            "%Y-%m-%d %H:%M:%S")
                         installInfo["remarks"] = ""
                         installInfo["sudo"] = not os.access(
                             installInfo["eric"], os.W_OK)
--- a/scripts/install.py	Mon Oct 19 20:02:01 2020 +0200
+++ b/scripts/install.py	Wed Oct 21 20:00:57 2020 +0200
@@ -22,6 +22,7 @@
 import io
 import json
 import shlex
+import datetime
 
 # Define the globals.
 progName = None
@@ -1308,6 +1309,7 @@
     """
     global installInfo, cfg
     
+    installDateTime = datetime.datetime.now(tz=None)
     try:
         installInfo["sudo"] = os.getuid() == 0
     except AttributeError:
@@ -1319,11 +1321,16 @@
     installInfo["virtualenv"] = installInfo["eric"].startswith(
         os.path.expanduser("~"))
     installInfo["installed"] = True
+    installInfo["installed_on"] = installDateTime.strftime(
+        "%Y-%m-%d %H:%M:%S")
     installInfo["guessed"] = False
     installInfo["edited"] = False
     installInfo["pip"] = False
     installInfo["remarks"] = ""
-
+    installInfo["exe_edited"] = False
+    installInfo["argv_edited"] = False
+    installInfo["eric_edited"] = False
+    # TODO: add current path (os.getcwd())
 
 def pipInstall(packageName, message):
     """
--- a/setup.py	Mon Oct 19 20:02:01 2020 +0200
+++ b/setup.py	Wed Oct 21 20:00:57 2020 +0200
@@ -262,10 +262,14 @@
         "eric": "",
         "virtualenv": False,
         "installed": False,
+        "installed_on": "",
         "guessed": False,
         "edited": False,
         "pip": True,
         "remarks": "",
+        "exe_edited": False,
+        "argv_edited": False,
+        "eric_edited": False,
     }
     with open(os.path.join(dirName, installInfoName), "w") as infoFile:
         json.dump(installInfo, infoFile, indent=2)

eric ide

mercurial