82 # interpreter: the path of the Python interpreter |
82 # interpreter: the path of the Python interpreter |
83 # variant: Python variant (always 3) |
83 # variant: Python variant (always 3) |
84 # is_global: a flag indicating a global environment |
84 # is_global: a flag indicating a global environment |
85 # is_conda: a flag indicating an Anaconda environment |
85 # is_conda: a flag indicating an Anaconda environment |
86 # is_remote: a flag indicating a remotely accessed environment |
86 # is_remote: a flag indicating a remotely accessed environment |
87 # is_eric_server a flag indicating an eric IDE server environment |
87 # is_eric_server a flag indicating an eric-ide server environment |
88 # eric_server a string giving the server name in case of an |
88 # eric_server a string giving the server name in case of an |
89 # eric IDE server environment |
89 # eric-ide server environment |
90 # exec_path: a string to be prefixed to the PATH environment |
90 # exec_path: a string to be prefixed to the PATH environment |
91 # setting |
91 # setting |
92 # description a description of the environment |
92 # description a description of the environment |
93 # |
93 # |
94 for venvName in environments: |
94 for venvName in environments: |
154 Preferences.syncPreferences() |
154 Preferences.syncPreferences() |
155 self.__loadSettings() |
155 self.__loadSettings() |
156 |
156 |
157 def __cleanEnvironments(self): |
157 def __cleanEnvironments(self): |
158 """ |
158 """ |
159 Private method to delete all non-existent local or eric IDE server environments. |
159 Private method to delete all non-existent local or eric-ide server environments. |
160 """ |
160 """ |
161 removed = False |
161 removed = False |
162 |
162 |
163 for venvName in list(self.__virtualEnvironments): |
163 for venvName in list(self.__virtualEnvironments): |
164 venvItem = self.__virtualEnvironments[venvName] |
164 venvItem = self.__virtualEnvironments[venvName] |
165 if not venvItem.is_remote: |
165 if not venvItem.is_remote: |
166 venvPath = venvItem.path |
166 venvPath = venvItem.path |
167 if venvPath: |
167 if venvPath: |
168 if venvItem.is_eric_server: |
168 if venvItem.is_eric_server: |
169 # It is an eric IDE server environment; check it is still valid. |
169 # It is an eric-ide server environment; check it is still valid. |
170 ericServer = ericApp().getObject("EricServer") |
170 ericServer = ericApp().getObject("EricServer") |
171 if ( |
171 if ( |
172 ericServer.isServerConnected() |
172 ericServer.isServerConnected() |
173 and ericServer.getHost() == venvItem.eric_server |
173 and ericServer.getHost() == venvItem.eric_server |
174 and not ericServer.getServiceInterface("FileSystem").exists( |
174 and not ericServer.getServiceInterface("FileSystem").exists( |
720 return self.__virtualEnvironmentsBaseDir |
720 return self.__virtualEnvironmentsBaseDir |
721 |
721 |
722 def isEricServerEnvironment(self, venvName, host=""): |
722 def isEricServerEnvironment(self, venvName, host=""): |
723 """ |
723 """ |
724 Public method to test, if a given environment is an environment accessed |
724 Public method to test, if a given environment is an environment accessed |
725 through an eric IDE server. |
725 through an eric-ide server. |
726 |
726 |
727 @param venvName logical name of the virtual environment |
727 @param venvName logical name of the virtual environment |
728 @type str |
728 @type str |
729 @param host name of the host to check for or empty string to just check for |
729 @param host name of the host to check for or empty string to just check for |
730 an eric IDE server environment |
730 an eric-ide server environment |
731 @return flag indicating an eric IDE server environment |
731 @return flag indicating an eric-ide server environment |
732 @rtype bool |
732 @rtype bool |
733 """ |
733 """ |
734 try: |
734 try: |
735 if host: |
735 if host: |
736 return ( |
736 return ( |
744 except KeyError: |
744 except KeyError: |
745 return False |
745 return False |
746 |
746 |
747 def getEricServerEnvironmentNames(self, host=""): |
747 def getEricServerEnvironmentNames(self, host=""): |
748 """ |
748 """ |
749 Public method to get a list of defined eric IDE server environments. |
749 Public method to get a list of defined eric-ide server environments. |
750 |
750 |
751 @param host host name to get environment names for (defaults to "") |
751 @param host host name to get environment names for (defaults to "") |
752 @type str (optional) |
752 @type str (optional) |
753 @return list of defined eric IDE server environments |
753 @return list of defined eric-ide server environments |
754 @rtype list of str |
754 @rtype list of str |
755 """ |
755 """ |
756 environments = [ |
756 environments = [ |
757 name |
757 name |
758 for name in self.__virtualEnvironments |
758 for name in self.__virtualEnvironments |