eric6/VirtualEnv/VirtualenvManager.py

changeset 7259
7c017076c12e
parent 7229
53054eb5b15a
child 7360
9190402e4505
equal deleted inserted replaced
7258:aff39db4dacc 7259:7c017076c12e
75 # exec_path: a string to be prefixed to the PATH environment 75 # exec_path: a string to be prefixed to the PATH environment
76 # setting 76 # setting
77 # 77 #
78 for venvName in environments: 78 for venvName in environments:
79 environment = environments[venvName] 79 environment = environments[venvName]
80 if ("is_remote" in environment and environment["is_remote"]) or \ 80 if (
81 os.access(environment["interpreter"], os.X_OK): 81 ("is_remote" in environment and environment["is_remote"]) or
82 os.access(environment["interpreter"], os.X_OK)
83 ):
82 if "is_global" not in environment: 84 if "is_global" not in environment:
83 environment["is_global"] = environment["path"] == "" 85 environment["is_global"] = environment["path"] == ""
84 if "is_conda" not in environment: 86 if "is_conda" not in environment:
85 environment["is_conda"] = False 87 environment["is_conda"] = False
86 if "is_remote" not in environment: 88 if "is_remote" not in environment:
155 @pyqtSlot() 157 @pyqtSlot()
156 def createVirtualEnv(self): 158 def createVirtualEnv(self):
157 """ 159 """
158 Public slot to create a new virtual environment. 160 Public slot to create a new virtual environment.
159 """ 161 """
160 from .VirtualenvConfigurationDialog import \ 162 from .VirtualenvConfigurationDialog import (
161 VirtualenvConfigurationDialog 163 VirtualenvConfigurationDialog
164 )
162 165
163 dlg = VirtualenvConfigurationDialog() 166 dlg = VirtualenvConfigurationDialog()
164 if dlg.exec_() == QDialog.Accepted: 167 if dlg.exec_() == QDialog.Accepted:
165 resultDict = dlg.getData() 168 resultDict = dlg.getData()
166 169
223 return 226 return
224 227
225 venvName = dlg.getName() 228 venvName = dlg.getName()
226 229
227 if not venvInterpreter: 230 if not venvInterpreter:
228 from .VirtualenvInterpreterSelectionDialog import \ 231 from .VirtualenvInterpreterSelectionDialog import (
229 VirtualenvInterpreterSelectionDialog 232 VirtualenvInterpreterSelectionDialog
233 )
230 dlg = VirtualenvInterpreterSelectionDialog(venvName, venvDirectory) 234 dlg = VirtualenvInterpreterSelectionDialog(venvName, venvDirectory)
231 if dlg.exec_() == QDialog.Accepted: 235 if dlg.exec_() == QDialog.Accepted:
232 venvInterpreter, venvVariant = dlg.getData() 236 venvInterpreter, venvVariant = dlg.getData()
233 237
234 if venvInterpreter: 238 if venvInterpreter:
347 @param venvNames list of logical names for the virtual environments 351 @param venvNames list of logical names for the virtual environments
348 @type list of str 352 @type list of str
349 """ 353 """
350 venvMessages = [] 354 venvMessages = []
351 for venvName in venvNames: 355 for venvName in venvNames:
352 if venvName in self.__virtualEnvironments and \ 356 if (
353 bool(self.__virtualEnvironments[venvName]["path"]): 357 venvName in self.__virtualEnvironments and
358 bool(self.__virtualEnvironments[venvName]["path"])
359 ):
354 venvMessages.append(self.tr("{0} - {1}").format( 360 venvMessages.append(self.tr("{0} - {1}").format(
355 venvName, self.__virtualEnvironments[venvName]["path"])) 361 venvName, self.__virtualEnvironments[venvName]["path"]))
356 if venvMessages: 362 if venvMessages:
357 from UI.DeleteFilesConfirmationDialog import \ 363 from UI.DeleteFilesConfirmationDialog import (
358 DeleteFilesConfirmationDialog 364 DeleteFilesConfirmationDialog
365 )
359 dlg = DeleteFilesConfirmationDialog( 366 dlg = DeleteFilesConfirmationDialog(
360 None, 367 None,
361 self.tr("Delete Virtual Environments"), 368 self.tr("Delete Virtual Environments"),
362 self.tr("""Do you really want to delete these virtual""" 369 self.tr("""Do you really want to delete these virtual"""
363 """ environments?"""), 370 """ environments?"""),
416 for venvName in venvNames: 423 for venvName in venvNames:
417 if venvName in self.__virtualEnvironments: 424 if venvName in self.__virtualEnvironments:
418 venvMessages.append(self.tr("{0} - {1}").format( 425 venvMessages.append(self.tr("{0} - {1}").format(
419 venvName, self.__virtualEnvironments[venvName]["path"])) 426 venvName, self.__virtualEnvironments[venvName]["path"]))
420 if venvMessages: 427 if venvMessages:
421 from UI.DeleteFilesConfirmationDialog import \ 428 from UI.DeleteFilesConfirmationDialog import (
422 DeleteFilesConfirmationDialog 429 DeleteFilesConfirmationDialog
430 )
423 dlg = DeleteFilesConfirmationDialog( 431 dlg = DeleteFilesConfirmationDialog(
424 None, 432 None,
425 self.tr("Remove Virtual Environments"), 433 self.tr("Remove Virtual Environments"),
426 self.tr("""Do you really want to remove these virtual""" 434 self.tr("""Do you really want to remove these virtual"""
427 """ environments?"""), 435 """ environments?"""),

eric ide

mercurial