154 copy.copy( |
154 copy.copy( |
155 self.__virtualEnvironments[VirtualenvManager.DefaultKey]) |
155 self.__virtualEnvironments[VirtualenvManager.DefaultKey]) |
156 ) |
156 ) |
157 |
157 |
158 else: |
158 else: |
159 defaultPy = sys.executable.replace("w.exe", ".exe") |
159 return self.environmentForInterpreter(sys.executable) |
160 for venvName in self.__virtualEnvironments: |
160 |
161 if (defaultPy == |
161 def environmentForInterpreter(self, interpreter): |
162 self.__virtualEnvironments[venvName]["interpreter"]): |
162 """ |
163 return ( |
163 Public method to get the environment a given interpreter belongs to. |
164 venvName, |
164 |
165 copy.copy(self.__virtualEnvironments[venvName]) |
165 @param interpreter path of the interpreter |
166 ) |
166 @type str |
|
167 @return tuple containing the environment name and a dictionary |
|
168 containing a copy of the default virtual environment |
|
169 @rtype tuple of (str, dict) |
|
170 """ |
|
171 py = interpreter.replace("w.exe", ".exe") |
|
172 for venvName in self.__virtualEnvironments: |
|
173 if (py == self.__virtualEnvironments[venvName]["interpreter"]): |
|
174 return ( |
|
175 venvName, |
|
176 copy.copy(self.__virtualEnvironments[venvName]) |
|
177 ) |
167 |
178 |
168 return ("", {}) |
179 return ("", {}) |
169 |
180 |
170 @pyqtSlot() |
181 @pyqtSlot() |
171 def createVirtualEnv(self, baseDir=""): |
182 def createVirtualEnv(self, baseDir=""): |