10 import os |
10 import os |
11 import sys |
11 import sys |
12 import logging |
12 import logging |
13 import shutil |
13 import shutil |
14 import json |
14 import json |
|
15 import datetime |
15 |
16 |
16 from PyQt5.QtCore import ( |
17 from PyQt5.QtCore import ( |
17 pyqtSlot, QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate, |
18 pyqtSlot, QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate, |
18 QIODevice, qVersion, QProcess, QSize, QUrl, QObject, Qt, QUuid, QThread, |
19 QIODevice, qVersion, QProcess, QSize, QUrl, QObject, Qt, QUuid, QThread, |
19 QUrlQuery |
20 QUrlQuery |
1476 filename = os.path.join(getConfig("ericDir"), |
1477 filename = os.path.join(getConfig("ericDir"), |
1477 "eric6installpip.json") |
1478 "eric6installpip.json") |
1478 if os.path.exists(filename): |
1479 if os.path.exists(filename): |
1479 # eric was installed via pip (i.e. eric-ide) |
1480 # eric was installed via pip (i.e. eric-ide) |
1480 try: |
1481 try: |
|
1482 installDateTime = datetime.datetime.now(tz=None) |
1481 with open(filename, "r") as infoFile: |
1483 with open(filename, "r") as infoFile: |
1482 installInfo = json.load(infoFile) |
1484 installInfo = json.load(infoFile) |
1483 installInfo["guessed"] = True |
1485 installInfo["guessed"] = True |
1484 installInfo["eric"] = getConfig("ericDir") |
1486 installInfo["eric"] = getConfig("ericDir") |
1485 installInfo["virtualenv"] = ( |
1487 installInfo["virtualenv"] = ( |
1488 ) |
1490 ) |
1489 if installInfo["virtualenv"]: |
1491 if installInfo["virtualenv"]: |
1490 installInfo["user"] = os.getlogin() |
1492 installInfo["user"] = os.getlogin() |
1491 installInfo["exe"] = sys.executable |
1493 installInfo["exe"] = sys.executable |
1492 installInfo["installed"] = True |
1494 installInfo["installed"] = True |
|
1495 installInfo["installed_on"] = installDateTime.strftime( |
|
1496 "%Y-%m-%d %H:%M:%S") |
1493 installInfo["remarks"] = "" |
1497 installInfo["remarks"] = "" |
1494 installInfo["sudo"] = not os.access( |
1498 installInfo["sudo"] = not os.access( |
1495 installInfo["eric"], os.W_OK) |
1499 installInfo["eric"], os.W_OK) |
1496 with open(installInfoFile, "w") as infoFile: |
1500 with open(installInfoFile, "w") as infoFile: |
1497 json.dump(installInfo, infoFile, indent=2) |
1501 json.dump(installInfo, infoFile, indent=2) |