diff -r 97f77d69c6f0 -r 1cbc27e34ec6 scripts/install.py --- a/scripts/install.py Sun Oct 18 12:42:37 2020 +0200 +++ b/scripts/install.py Sun Oct 18 18:51:45 2020 +0200 @@ -52,6 +52,9 @@ macAppBundlePath = defaultMacAppBundlePath macPythonExe = defaultMacPythonExe +installInfoName = "eric6install.json" +installInfo = {} + # Define blacklisted versions of the prerequisites BlackLists = { "sip": [], @@ -1233,6 +1236,13 @@ "MicroPython", "*.api"))): apis.append(os.path.basename(apiName)) + if sys.platform == "darwin": + macConfig = ( + """ 'macAppBundlePath': r'{0}',\n""" + """ 'macAppBundleName': r'{1}',\n""" + ).format(macAppBundlePath, macAppBundleName) + else: + macConfig = "" config = ( """# -*- coding: utf-8 -*-\n""" """#\n""" @@ -1257,8 +1267,7 @@ """ 'mdir': r'{13}',\n""" """ 'apidir': r'{14}',\n""" """ 'apis': {15},\n""" - """ 'macAppBundlePath': r'{16}',\n""" - """ 'macAppBundleName': r'{17}',\n""" + """{16}""" """}}\n""" """\n""" """def getConfig(name):\n""" @@ -1287,11 +1296,34 @@ cfg['ericCodeTemplatesDir'], cfg['ericOthersDir'], cfg['bindir'], cfg['mdir'], cfg['apidir'], sorted(apis), - macAppBundlePath, macAppBundleName, + macConfig, ) copyToFile(configName, config) +def createInstallInfo(): + """ + Record information about the way eric6 was installed. + """ + global installInfo, cfg + + try: + installInfo["sudo"] = os.getuid() == 0 + except AttributeError: + installInfo["sudo"] = False + installInfo["user"] = os.getlogin() + installInfo["exe"] = sys.executable + installInfo["argv"] = sys.argv[:] + installInfo["eric"] = cfg["ericDir"] + installInfo["virtualenv"] = installInfo["eric"].startswith( + os.path.expanduser("~")) + installInfo["installed"] = True + installInfo["guessed"] = False + installInfo["edited"] = False + installInfo["pip"] = False + installInfo["remarks"] = "" + + def pipInstall(packageName, message): """ Install the given package via pip. @@ -1936,6 +1968,8 @@ print("\nCreating configuration file ...") createConfig() + createInstallInfo() + # Compile .ui files print("\nCompiling user interface files ...") # step 1: remove old Ui_*.py files @@ -1970,6 +2004,10 @@ print("\nInstalling eric6 ...") res = installEric() + with open(os.path.join(cfg["ericDir"], + installInfoName), "w") as installInfoFile: + json.dump(installInfo, installInfoFile, indent=2) + # do some cleanup try: if installFromSource: