src/eric7/Project/Project.py

branch
eric7
changeset 9639
9e66fd88193c
parent 9638
6ee095b9d3bd
child 9640
d10c17b89372
equal deleted inserted replaced
9638:6ee095b9d3bd 9639:9e66fd88193c
2817 @param mainscript name of the mainscript (string) 2817 @param mainscript name of the mainscript (string)
2818 """ 2818 """
2819 # Show the file type associations for the user to change 2819 # Show the file type associations for the user to change
2820 self.__showFiletypeAssociations() 2820 self.__showFiletypeAssociations()
2821 2821
2822 ignoreList = []
2823 if self.__pdata["EMBEDDED_VENV"]:
2824 environmentPath = self.__findEmbeddedEnvironment()
2825 if environmentPath:
2826 # there is already an embeded venv; ignore thie whenn adding files
2827 ignoreList = [os.path.split(environmentPath)[-1]]
2822 with EricOverrideCursor(): 2828 with EricOverrideCursor():
2823 # search the project directory for files with known extensions 2829 # search the project directory for files with known extensions
2824 filespecs = list(self.__pdata["FILETYPES"].keys()) 2830 filespecs = list(self.__pdata["FILETYPES"].keys())
2825 for filespec in filespecs: 2831 for filespec in filespecs:
2826 files = FileSystemUtilities.direntries(self.ppath, True, filespec) 2832 files = FileSystemUtilities.direntries(
2833 self.ppath,
2834 filesonly=True,
2835 pattern=filespec,
2836 ignore=ignoreList,
2837 )
2827 for file in files: 2838 for file in files:
2828 self.appendFile(file) 2839 self.appendFile(file)
2829 2840
2830 # special handling for translation files 2841 # special handling for translation files
2831 if self.translationsRoot: 2842 if self.translationsRoot:
6953 6964
6954 from .ProjectVenvCreationParametersDialog import ( 6965 from .ProjectVenvCreationParametersDialog import (
6955 ProjectVenvCreationParametersDialog, 6966 ProjectVenvCreationParametersDialog,
6956 ) 6967 )
6957 6968
6958 if force or upgrade or not self.__findEmbeddedEnvironment(): 6969 environmentPath = self.__findEmbeddedEnvironment()
6970 if force or upgrade or not environmentPath:
6959 dlg = ProjectVenvCreationParametersDialog( 6971 dlg = ProjectVenvCreationParametersDialog(
6960 withSystemSitePackages=self.__venvConfiguration["system_site_packages"] 6972 withSystemSitePackages=self.__venvConfiguration["system_site_packages"]
6961 ) 6973 )
6962 if dlg.exec() != QDialog.DialogCode.Accepted: 6974 if dlg.exec() != QDialog.DialogCode.Accepted:
6963 # user canceled the environment creation 6975 # user canceled the environment creation
7002 # re-install the project into the upgraded environment 7014 # re-install the project into the upgraded environment
7003 # Note: seems to fail on some systems with access to system 7015 # Note: seems to fail on some systems with access to system
7004 # site-packages 7016 # site-packages
7005 self.__installProjectIntoEnvironment() 7017 self.__installProjectIntoEnvironment()
7006 7018
7019 if (
7020 environmentPath
7021 and not self.__venvConfiguration["interpreter"].startswith(environmentPath)
7022 ):
7023 self.__configureEnvironment(environmentPath)
7024
7007 @pyqtSlot() 7025 @pyqtSlot()
7008 def __configureEnvironment(self, environmentPath=""): 7026 def __configureEnvironment(self, environmentPath=""):
7009 """ 7027 """
7010 Private slot to configure the embedded environment. 7028 Private slot to configure the embedded environment.
7011 7029
7013 @type str (optional) 7031 @type str (optional)
7014 """ 7032 """
7015 from .ProjectVenvConfigurationDialog import ProjectVenvConfigurationDialog 7033 from .ProjectVenvConfigurationDialog import ProjectVenvConfigurationDialog
7016 7034
7017 if not environmentPath: 7035 if not environmentPath:
7018 environmentPath = os.path.join(self.getProjectPath(), ".venv") 7036 environmentPath = self.__findEmbeddedEnvironment()
7037 if not environmentPath:
7038 environmentPath = os.path.join(self.getProjectPath(), ".venv")
7019 7039
7020 dlg = ProjectVenvConfigurationDialog( 7040 dlg = ProjectVenvConfigurationDialog(
7021 self.__venvConfiguration["name"], 7041 self.__venvConfiguration["name"],
7022 environmentPath, 7042 environmentPath,
7023 self.__venvConfiguration["interpreter"], 7043 self.__venvConfiguration["interpreter"],

eric ide

mercurial