7105 Private method to find the path of the embedded virtual environment. |
7105 Private method to find the path of the embedded virtual environment. |
7106 |
7106 |
7107 @return path of the embedded virtual environment (empty if not found) |
7107 @return path of the embedded virtual environment (empty if not found) |
7108 @rtype str |
7108 @rtype str |
7109 """ |
7109 """ |
7110 with os.scandir(self.getProjectPath()) as ppathDirEntriesIterator: |
7110 ppath = self.getProjectPath() |
7111 for dirEntry in ppathDirEntriesIterator: |
7111 if ppath and os.path.exists(ppath): |
7112 # potential venv directory; check for 'pyvenv.cfg' |
7112 with os.scandir(self.getProjectPath()) as ppathDirEntriesIterator: |
7113 if dirEntry.is_dir() and os.path.exists( |
7113 for dirEntry in ppathDirEntriesIterator: |
7114 os.path.join(dirEntry.path, "pyvenv.cfg") |
7114 # potential venv directory; check for 'pyvenv.cfg' |
7115 ): |
7115 if dirEntry.is_dir() and os.path.exists( |
7116 return dirEntry.path |
7116 os.path.join(dirEntry.path, "pyvenv.cfg") |
7117 |
7117 ): |
7118 # check for some common names in case 'pyvenv.cfg' is missing |
7118 return dirEntry.path |
7119 for venvPathName in (".venv", "venv", ".env", "env"): |
7119 |
7120 venvPath = os.path.join(self.getProjectPath(), venvPathName) |
7120 # check for some common names in case 'pyvenv.cfg' is missing |
7121 if os.path.isdir(venvPath): |
7121 for venvPathName in (".venv", "venv", ".env", "env"): |
7122 return venvPath |
7122 venvPath = os.path.join(self.getProjectPath(), venvPathName) |
|
7123 if os.path.isdir(venvPath): |
|
7124 return venvPath |
7123 |
7125 |
7124 return "" |
7126 return "" |
7125 |
7127 |
7126 def __setEmbeddedEnvironmentProjectConfig(self, value): |
7128 def __setEmbeddedEnvironmentProjectConfig(self, value): |
7127 """ |
7129 """ |