391 if not venvName: |
391 if not venvName: |
392 venvName = self.__plugin.getPreferences( |
392 venvName = self.__plugin.getPreferences( |
393 "VirtualEnvironmentNamePy3") |
393 "VirtualEnvironmentNamePy3") |
394 else: |
394 else: |
395 venvName = "" |
395 venvName = "" |
396 if venvName: |
396 virtEnv = ( |
397 virtEnv = self.__virtualEnvManager.getVirtualenvDirectory( |
397 self.__virtualEnvManager.getVirtualenvDirectory(venvName) |
398 venvName) |
398 if venvName else |
399 else: |
399 "" |
400 virtEnv = "" |
400 ) |
401 |
401 |
402 if virtEnv and not os.path.exists(virtEnv): |
402 if virtEnv and not os.path.exists(virtEnv): |
403 virtEnv = "" |
403 virtEnv = "" |
404 |
404 |
405 return virtEnv # __IGNORE_WARNING_M834__ |
405 return virtEnv # __IGNORE_WARNING_M834__ |
424 @type str |
424 @type str |
425 @return full command |
425 @return full command |
426 @rtype str |
426 @rtype str |
427 """ |
427 """ |
428 virtualEnv = virtualEnvPath or self.getVirtualEnvironment() |
428 virtualEnv = virtualEnvPath or self.getVirtualEnvironment() |
429 if isWindowsPlatform(): |
429 fullCmds = ( |
430 fullCmds = [ |
430 [os.path.join(virtualEnv, "Scripts", command + '.exe'), |
431 os.path.join(virtualEnv, "Scripts", command + '.exe'), |
431 os.path.join(virtualEnv, "bin", command + '.exe'), |
432 os.path.join(virtualEnv, "bin", command + '.exe'), |
432 command] # fall back to just cmd |
433 command # fall back to just cmd |
433 if isWindowsPlatform() else |
434 ] |
434 [os.path.join(virtualEnv, "bin", command), |
435 else: |
435 os.path.join(virtualEnv, "local", "bin", command), |
436 fullCmds = [ |
436 Utilities.getExecutablePath(command), |
437 os.path.join(virtualEnv, "bin", command), |
437 command] # fall back to just cmd |
438 os.path.join(virtualEnv, "local", "bin", command), |
438 ) |
439 Utilities.getExecutablePath(command), |
|
440 command # fall back to just cmd |
|
441 ] |
|
442 for command in fullCmds: |
439 for command in fullCmds: |
443 if os.path.exists(command): |
440 if os.path.exists(command): |
444 break |
441 break |
445 return command |
442 return command |
446 |
443 |