8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 import sys |
11 import sys |
12 import logging |
12 import logging |
|
13 import shutil |
|
14 import json |
13 |
15 |
14 from PyQt5.QtCore import ( |
16 from PyQt5.QtCore import ( |
15 pyqtSlot, QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate, |
17 pyqtSlot, QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate, |
16 QIODevice, qVersion, QProcess, QSize, QUrl, QObject, Qt, QUuid, QThread, |
18 QIODevice, qVersion, QProcess, QSize, QUrl, QObject, Qt, QUuid, QThread, |
17 QUrlQuery |
19 QUrlQuery |
1455 |
1457 |
1456 if opens == 0: |
1458 if opens == 0: |
1457 # no files, project or multiproject was given |
1459 # no files, project or multiproject was given |
1458 if not self.__noOpenAtStartup: |
1460 if not self.__noOpenAtStartup: |
1459 self.__openOnStartup() |
1461 self.__openOnStartup() |
1460 |
1462 |
|
1463 def processInstallInfoFile(self): |
|
1464 """ |
|
1465 Public method to process the file containing installation information. |
|
1466 """ |
|
1467 import Globals |
|
1468 |
|
1469 installInfoFile = Globals.getInstallInfoFilePath() |
|
1470 if not os.path.exists(installInfoFile): |
|
1471 filename = os.path.join(getConfig("ericDir"), "eric6install.json") |
|
1472 if os.path.exists(filename): |
|
1473 # eric was installed via the install.py script |
|
1474 shutil.copy2(filename, installInfoFile) |
|
1475 else: |
|
1476 filename = os.path.join(getConfig("ericDir"), |
|
1477 "eric6installpip.json") |
|
1478 if os.path.exists(filename): |
|
1479 # eric was installed via pip (i.e. eric-ide) |
|
1480 try: |
|
1481 with open(filename, "r") as infoFile: |
|
1482 installInfo = json.load(infoFile) |
|
1483 installInfo["guessed"] = True |
|
1484 installInfo["eric"] = getConfig("ericDir") |
|
1485 installInfo["virtualenv"] = ( |
|
1486 installInfo["eric"].startswith( |
|
1487 os.path.expanduser("~")) |
|
1488 ) |
|
1489 if installInfo["virtualenv"]: |
|
1490 installInfo["user"] = os.getlogin() |
|
1491 installInfo["exe"] = sys.executable |
|
1492 installInfo["installed"] = True |
|
1493 installInfo["remarks"] = "" |
|
1494 installInfo["sudo"] = not os.access( |
|
1495 installInfo["eric"], os.W_OK) |
|
1496 with open(installInfoFile, "w") as infoFile: |
|
1497 json.dump(installInfo, infoFile, indent=2) |
|
1498 except EnvironmentError: |
|
1499 # ignore this |
|
1500 pass |
|
1501 |
1461 def __createDockWindow(self, name): |
1502 def __createDockWindow(self, name): |
1462 """ |
1503 """ |
1463 Private method to create a dock window with common properties. |
1504 Private method to create a dock window with common properties. |
1464 |
1505 |
1465 @param name object name of the new dock window (string) |
1506 @param name object name of the new dock window (string) |