--- a/CondaInterface/Conda.py Sun Feb 10 17:24:10 2019 +0100 +++ b/CondaInterface/Conda.py Sun Feb 10 19:46:34 2019 +0100 @@ -609,7 +609,7 @@ def updateConda(self): """ - Private method to update conda itself. + Public method to update conda itself. """ args = [ "update", @@ -624,3 +624,49 @@ ok, _ = dlg.getResult() return ok + + def writeDefaultConfiguration(self): + """ + Public method to create a conda configuration with default values. + """ + args = [ + "config", + "--write-default", + "--quiet" + ] + + exe = Preferences.getConda("CondaExecutable") + if not exe: + exe = "conda" + + proc = QProcess() + proc.start(exe, args) + proc.waitForStarted(15000) + proc.waitForFinished(30000) + + def getCondaInformation(self): + """ + Public method to get a dictionary containing information about conda. + + @return dictionary containing information about conda + @rtype dict + """ + exe = Preferences.getConda("CondaExecutable") + if not exe: + exe = "conda" + + infoDict = {} + + proc = QProcess() + proc.start(exe, ["info", "--json"]) + if proc.waitForStarted(15000): + if proc.waitForFinished(15000): + output = str(proc.readAllStandardOutput(), + Preferences.getSystem("IOEncoding"), + 'replace').strip() + try: + infoDict = json.loads(output) + except Exception: + infoDict = {} + + return infoDict