--- a/src/eric7/Project/Project.py Mon Jun 10 15:42:18 2024 +0200 +++ b/src/eric7/Project/Project.py Mon Jun 10 16:28:21 2024 +0200 @@ -3196,7 +3196,9 @@ # set the auto save flag to its supposed value Preferences.setProject("AutoSaveProject", autoSaveProject) - if self.__pdata["EMBEDDED_VENV"]: + if self.__pdata[ + "EMBEDDED_VENV" + ] and not FileSystemUtilities.isRemoteFileName(self.ppath): self.__createEmbeddedEnvironment() self.menuEnvironmentAct.setEnabled( self.__pdata["EMBEDDED_VENV"] @@ -3508,7 +3510,11 @@ if self.__pdata["FILETYPES"] != fileTypesDict: self.__reorganizeFiles() - if self.__pdata["EMBEDDED_VENV"] and not self.__findEmbeddedEnvironment(): + if ( + self.__pdata["EMBEDDED_VENV"] + and not FileSystemUtilities.isRemoteFileName(self.ppath) + and not self.__findEmbeddedEnvironment() + ): self.__createEmbeddedEnvironment() def __showUserProperties(self): @@ -3787,7 +3793,9 @@ self.__model.projectOpened() - if self.__pdata["EMBEDDED_VENV"]: + if self.__pdata[ + "EMBEDDED_VENV" + ] and not FileSystemUtilities.isRemoteFileName(self.ppath): envPath = self.__findEmbeddedEnvironment() if bool(envPath): self.__loadEnvironmentConfiguration() @@ -4581,10 +4589,13 @@ @return name of the project's virtual environment @rtype str """ - # TODO: remote server not supported yet venvName = ( self.__venvConfiguration["name"] - if self.__pdata["EMBEDDED_VENV"] and bool(self.__venvConfiguration["name"]) + if ( + self.__pdata["EMBEDDED_VENV"] + and not FileSystemUtilities.isRemoteFileName(self.ppath) + and bool(self.__venvConfiguration["name"]) + ) else self.getDebugProperty("VIRTUALENV") ) if ( @@ -4603,8 +4614,10 @@ @return path name of the embedded virtual environment @rtype str """ - # TODO: remote server not supported yet - if self.__pdata["EMBEDDED_VENV"]: + if ( + self.__pdata["EMBEDDED_VENV"] + and not FileSystemUtilities.isRemoteFileName(self.ppath) + ): return self.__findEmbeddedEnvironment() else: return "" @@ -4620,10 +4633,12 @@ @return path of the project's interpreter @rtype str """ - # TODO: remote server not supported yet interpreter = ( self.__venvConfiguration["interpreter"] - if self.__pdata["EMBEDDED_VENV"] + if ( + self.__pdata["EMBEDDED_VENV"] + and not FileSystemUtilities.isRemoteFileName(self.ppath) + ) else "" ) if not interpreter: @@ -4667,7 +4682,7 @@ @return testing framework name of the project @rtype str """ - # TODO: remote server not supported yet + # TODO: remote server testing not supported yet try: return self.__pdata["TESTING_FRAMEWORK"] except KeyError: @@ -7754,20 +7769,27 @@ @rtype str """ ppath = self.getProjectPath() - if ppath and os.path.exists(ppath): - with os.scandir(self.getProjectPath()) as ppathDirEntriesIterator: - for dirEntry in ppathDirEntriesIterator: - # potential venv directory; check for 'pyvenv.cfg' - if dirEntry.is_dir() and os.path.exists( - os.path.join(dirEntry.path, "pyvenv.cfg") - ): - return dirEntry.path - - # check for some common names in case 'pyvenv.cfg' is missing + if FileSystemUtilities.isRemoteFileName(ppath): + # check for some common names for venvPathName in (".venv", "venv", ".env", "env"): - venvPath = os.path.join(self.getProjectPath(), venvPathName) - if os.path.isdir(venvPath): + venvPath = self.__remotefsInterface.join(ppath, venvPathName) + if self.__remotefsInterface.isdir(venvPath): return venvPath + else: + if ppath and os.path.exists(ppath): + with os.scandir(self.getProjectPath()) as ppathDirEntriesIterator: + for dirEntry in ppathDirEntriesIterator: + # potential venv directory; check for 'pyvenv.cfg' + if dirEntry.is_dir() and os.path.exists( + os.path.join(dirEntry.path, "pyvenv.cfg") + ): + return dirEntry.path + + # check for some common names in case 'pyvenv.cfg' is missing + for venvPathName in (".venv", "venv", ".env", "env"): + venvPath = os.path.join(ppath, venvPathName) + if os.path.isdir(venvPath): + return venvPath return ""