Sat, 07 Sep 2019 17:35:43 +0200
Closed branch after it was merged into 'default'.
6677
6299d69a218a
Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
6299d69a218a
Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
6299d69a218a
Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3 | # Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
6299d69a218a
Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
6299d69a218a
Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
6299d69a218a
Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
6299d69a218a
Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Package implementing the various conda related modules. |
6299d69a218a
Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
6681
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
9 | |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
10 | from __future__ import unicode_literals |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
11 | |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
12 | import json |
6681
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
13 | |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
14 | from PyQt5.QtCore import QCoreApplication, QProcess |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
15 | |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
16 | import Preferences |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
17 | |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
18 | __CondaVersion = tuple() |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
19 | __CondaVersionStr = "" |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
20 | __CondaRootPrefix = "" |
6724
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
21 | __CondaUserConfig = "" |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
22 | |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
23 | __initialized = False |
6681
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
24 | |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
25 | |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
26 | def __initializeCondaInterface(): |
6681
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
27 | """ |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
28 | Private module function to (re-)initialize the conda interface. |
6681
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
29 | """ |
6724
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
30 | global __CondaVersionStr, __CondaVersion, __CondaRootPrefix, \ |
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
31 | __CondaUserConfig, __initialized |
6681
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
32 | |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
33 | if not __initialized: |
6681
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
34 | exe = Preferences.getConda("CondaExecutable") |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
35 | if not exe: |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
36 | exe = "conda" |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
37 | |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
38 | proc = QProcess() |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
39 | proc.start(exe, ["info", "--json"]) |
6681
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
40 | if not proc.waitForStarted(15000): |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
41 | __CondaVersionStr = QCoreApplication.translate( |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
42 | "CondaInterface", |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
43 | '<conda not found or not configured.>') |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
44 | else: |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
45 | proc.waitForFinished(15000) |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
46 | output = str(proc.readAllStandardOutput(), |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
47 | Preferences.getSystem("IOEncoding"), |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
48 | 'replace').strip() |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
49 | try: |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
50 | jsonDict = json.loads(output) |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
51 | except Exception: |
6681
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
52 | __CondaVersionStr = QCoreApplication.translate( |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
53 | "CondaInterface", |
6771
bcffbb627791
Updated the translations for the new conda interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6741
diff
changeset
|
54 | '<conda returned invalid data.>') |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
55 | return |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
56 | |
7093
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
57 | if "error" in jsonDict: |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
58 | __CondaVersionStr = QCoreApplication.translate( |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
59 | "CondaInterface", |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
60 | '<conda returned an error: {0}.>').format( |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
61 | jsonDict["error"]) |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
62 | else: |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
63 | __CondaVersionStr = jsonDict["conda_version"] |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
64 | __CondaVersion = tuple( |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
65 | int(i) for i in __CondaVersionStr.split(".") |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
66 | ) |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
67 | __CondaRootPrefix = jsonDict["root_prefix"] |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
68 | if "user_rc_path" in jsonDict: |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
69 | __CondaUserConfig = jsonDict["user_rc_path"] |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
70 | elif "rc_path" in jsonDict: |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
71 | __CondaUserConfig = jsonDict["rc_path"] |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
72 | |
5b6c7e9f875d
CondaInterface: fixed an issue obtaining the conda version info on Windows starting with conda 4.7.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
73 | __initialized = True |
6681
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
74 | |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
75 | |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
76 | def condaVersion(): |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
77 | """ |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
78 | Module function to get the conda version. |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
79 | |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
80 | @return tuple containing the conda version |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
81 | @rtype tuple of (int, int, int) |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
82 | """ |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
83 | __initializeCondaInterface() |
6681
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
84 | return __CondaVersion |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
85 | |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
86 | |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
87 | def condaVersionStr(): |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
88 | """ |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
89 | Module function to get the conda version as a string. |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
90 | |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
91 | @return conda version as a string |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
92 | @rtype str |
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
93 | """ |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
94 | __initializeCondaInterface() |
6681
9c1513b488ef
CondaInterface, VirtualenvConfigurationDialog: moved the version related functions to the CondaInterface package.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6677
diff
changeset
|
95 | return __CondaVersionStr |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
96 | |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
97 | |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
98 | def rootPrefix(): |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
99 | """ |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
100 | Module function to get the root prefix. |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
101 | |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
102 | @return root prefix |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
103 | @rtype str |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
104 | """ |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
105 | __initializeCondaInterface() |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
106 | return __CondaRootPrefix |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
107 | |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
108 | |
6724
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
109 | def userConfiguration(): |
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
110 | """ |
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
111 | Module function to get the path of the user configuration file. |
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
112 | |
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
113 | @return path of the user configuration file |
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
114 | @rtype str |
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
115 | """ |
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
116 | __initializeCondaInterface() |
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
117 | return __CondaUserConfig |
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
118 | |
ca89c7d94c94
Conda: started implementing the conda menu functionality
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6697
diff
changeset
|
119 | |
6738
a7f835b41606
CondaPackagesWidget: show an error string if conda is not available. No other interface element are shown in that case.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6724
diff
changeset
|
120 | def isCondaAvailable(): |
a7f835b41606
CondaPackagesWidget: show an error string if conda is not available. No other interface element are shown in that case.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6724
diff
changeset
|
121 | """ |
a7f835b41606
CondaPackagesWidget: show an error string if conda is not available. No other interface element are shown in that case.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6724
diff
changeset
|
122 | Module function to check the availability of conda. |
a7f835b41606
CondaPackagesWidget: show an error string if conda is not available. No other interface element are shown in that case.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6724
diff
changeset
|
123 | |
a7f835b41606
CondaPackagesWidget: show an error string if conda is not available. No other interface element are shown in that case.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6724
diff
changeset
|
124 | @return flag indicating conda availability |
a7f835b41606
CondaPackagesWidget: show an error string if conda is not available. No other interface element are shown in that case.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6724
diff
changeset
|
125 | @rtype bool |
a7f835b41606
CondaPackagesWidget: show an error string if conda is not available. No other interface element are shown in that case.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6724
diff
changeset
|
126 | """ |
a7f835b41606
CondaPackagesWidget: show an error string if conda is not available. No other interface element are shown in that case.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6724
diff
changeset
|
127 | __initializeCondaInterface() |
a7f835b41606
CondaPackagesWidget: show an error string if conda is not available. No other interface element are shown in that case.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6724
diff
changeset
|
128 | return bool(__CondaVersion) |
a7f835b41606
CondaPackagesWidget: show an error string if conda is not available. No other interface element are shown in that case.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6724
diff
changeset
|
129 | |
6741
33a82a20dd3a
Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6738
diff
changeset
|
130 | |
6697
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
131 | def resetInterface(): |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
132 | """ |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
133 | Module function to reset the conda interface. |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
134 | """ |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
135 | global __initialized |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
136 | |
2f5c951bdf14
Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6681
diff
changeset
|
137 | __initialized = False |