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 |
|
89 # eric IDE server environment |
88 # exec_path: a string to be prefixed to the PATH environment |
90 # exec_path: a string to be prefixed to the PATH environment |
89 # setting |
91 # setting |
90 # description a description of the environment |
92 # description a description of the environment |
91 # |
93 # |
92 for venvName in environments: |
94 for venvName in environments: |
682 try: |
684 try: |
683 return self.__virtualEnvironments[venvName].is_remote |
685 return self.__virtualEnvironments[venvName].is_remote |
684 except KeyError: |
686 except KeyError: |
685 return False |
687 return False |
686 |
688 |
687 def isEricServerEnvironment(self, venvName): |
|
688 """ |
|
689 Public method to test, if a given environment is an environment accessed |
|
690 through an eric IDE server. |
|
691 |
|
692 @param venvName logical name of the virtual environment |
|
693 @type str |
|
694 @return flag indicating a remotely accessed environment |
|
695 @rtype bool |
|
696 """ |
|
697 try: |
|
698 return self.__virtualEnvironments[venvName].is_eric_server |
|
699 except KeyError: |
|
700 return False |
|
701 |
|
702 def getVirtualenvExecPath(self, venvName): |
689 def getVirtualenvExecPath(self, venvName): |
703 """ |
690 """ |
704 Public method to get the search path prefix of a virtual environment. |
691 Public method to get the search path prefix of a virtual environment. |
705 |
692 |
706 @param venvName logical name for the virtual environment |
693 @param venvName logical name for the virtual environment |
729 |
716 |
730 @return base directory for the virtual environments |
717 @return base directory for the virtual environments |
731 @rtype str |
718 @rtype str |
732 """ |
719 """ |
733 return self.__virtualEnvironmentsBaseDir |
720 return self.__virtualEnvironmentsBaseDir |
|
721 |
|
722 def isEricServerEnvironment(self, venvName, host=""): |
|
723 """ |
|
724 Public method to test, if a given environment is an environment accessed |
|
725 through an eric IDE server. |
|
726 |
|
727 @param venvName logical name of the virtual environment |
|
728 @type str |
|
729 @param host name of the host to check for or empty string to just check for |
|
730 an eric IDE server environment |
|
731 @return flag indicating an eric IDE server environment |
|
732 @rtype bool |
|
733 """ |
|
734 try: |
|
735 if host: |
|
736 return ( |
|
737 self.__virtualEnvironments[venvName].is_eric_server |
|
738 and self.__virtualEnvironments[venvName].eric_server.startswith( |
|
739 f"{host}:" |
|
740 ) |
|
741 ) |
|
742 else: |
|
743 return self.__virtualEnvironments[venvName].is_eric_server |
|
744 except KeyError: |
|
745 return False |
|
746 |
|
747 def getEricServerEnvironmentNames(self, host=""): |
|
748 """ |
|
749 Public method to get a list of defined eric IDE server environments. |
|
750 |
|
751 @param host host name to get environment names for (defaults to "") |
|
752 @type str (optional) |
|
753 @return list of defined eric IDE server environments |
|
754 @rtype list of str |
|
755 """ |
|
756 environments = [ |
|
757 name |
|
758 for name in self.__virtualEnvironments |
|
759 if self.isEricServerEnvironment(name, host=host) |
|
760 ] |
|
761 |
|
762 return environments |