1392 ) |
1392 ) |
1393 return |
1393 return |
1394 |
1394 |
1395 fn1, ext = os.path.splitext(os.path.basename(self.pfile)) |
1395 fn1, ext = os.path.splitext(os.path.basename(self.pfile)) |
1396 fn = os.path.join(self.getProjectManagementDir(), "{0}.edj".format(fn1)) |
1396 fn = os.path.join(self.getProjectManagementDir(), "{0}.edj".format(fn1)) |
1397 if ( |
1397 if os.path.exists(fn) and self.__debuggerPropertiesFile.readFile(fn): |
1398 os.path.exists(fn) |
|
1399 and self.__debuggerPropertiesFile.readFile(fn) |
|
1400 ): |
|
1401 self.debugPropertiesLoaded = True |
1398 self.debugPropertiesLoaded = True |
1402 self.debugPropertiesChanged = False |
1399 self.debugPropertiesChanged = False |
1403 |
1400 |
1404 @pyqtSlot() |
1401 @pyqtSlot() |
1405 def __writeDebugProperties(self, quiet=False): |
1402 def __writeDebugProperties(self, quiet=False): |
1482 Public method to return the status of the debug properties. |
1479 Public method to return the status of the debug properties. |
1483 |
1480 |
1484 @return load status of debug properties |
1481 @return load status of debug properties |
1485 @rtype bool |
1482 @rtype bool |
1486 """ |
1483 """ |
1487 return self.debugPropertiesLoaded or self.__pdata["EMBEDDED_VENV"] |
1484 return self.debugPropertiesLoaded |
1488 |
1485 |
1489 def __showDebugProperties(self): |
1486 def __showDebugProperties(self): |
1490 """ |
1487 """ |
1491 Private slot to display the debugger properties dialog. |
1488 Private slot to display the debugger properties dialog. |
1492 """ |
1489 """ |
4887 ) |
4884 ) |
4888 ) |
4885 ) |
4889 self.createSBOMAct.triggered.connect(self.__createSBOMFile) |
4886 self.createSBOMAct.triggered.connect(self.__createSBOMFile) |
4890 self.actions.append(self.createSBOMAct) |
4887 self.actions.append(self.createSBOMAct) |
4891 |
4888 |
|
4889 self.clearByteCodeCachesAct = EricAction( |
|
4890 self.tr("Clear Byte Code Caches"), |
|
4891 self.tr("Clear Byte Code &Caches"), |
|
4892 0, |
|
4893 0, |
|
4894 self.othersGrp, |
|
4895 "project_clear_bytecode_caches", |
|
4896 ) |
|
4897 self.clearByteCodeCachesAct.setStatusTip( |
|
4898 self.tr("Clear the byte code caches of the project.") |
|
4899 ) |
|
4900 self.clearByteCodeCachesAct.setWhatsThis( |
|
4901 self.tr( |
|
4902 """<b>Clear Byte Code Caches</b>""" |
|
4903 """<p>This deletes all directories containing byte code cache files.""" |
|
4904 """</p>""" |
|
4905 ) |
|
4906 ) |
|
4907 self.clearByteCodeCachesAct.triggered.connect(self.__clearByteCodeCaches) |
|
4908 self.actions.append(self.clearByteCodeCachesAct) |
|
4909 |
4892 ################################################################### |
4910 ################################################################### |
4893 ## Project Tools - code formatting actions - Black |
4911 ## Project Tools - code formatting actions - Black |
4894 ################################################################### |
4912 ################################################################### |
4895 |
4913 |
4896 self.blackFormattingGrp = createActionGroup(self) |
4914 self.blackFormattingGrp = createActionGroup(self) |
5586 # do not bother with dirs here... |
5604 # do not bother with dirs here... |
5587 if os.path.isdir(ns): |
5605 if os.path.isdir(ns): |
5588 if recursiveSearch: |
5606 if recursiveSearch: |
5589 d = self.getRelativePath(ns) |
5607 d = self.getRelativePath(ns) |
5590 if d not in dirs: |
5608 if d not in dirs: |
5591 dirs.append(d) # noqa: M538 |
5609 dirs.append(d) # noqa: M569 |
5592 continue |
5610 continue |
5593 |
5611 |
5594 filetype = "" |
5612 filetype = "" |
5595 bfn = os.path.basename(fn) |
5613 bfn = os.path.basename(fn) |
5596 for pattern in sorted(self.__pdata["FILETYPES"], reverse=True): |
5614 for pattern in sorted(self.__pdata["FILETYPES"], reverse=True): |
7150 self.__createEmbeddedEnvironment(upgrade=True) |
7168 self.__createEmbeddedEnvironment(upgrade=True) |
7151 except (OSError, json.JSONDecodeError): |
7169 except (OSError, json.JSONDecodeError): |
7152 # the configuration file does not exist or is invalid JSON |
7170 # the configuration file does not exist or is invalid JSON |
7153 self.__initVenvConfiguration() |
7171 self.__initVenvConfiguration() |
7154 |
7172 |
|
7173 ######################################################################### |
|
7174 ## Below are methods implementing some tool functionality |
|
7175 ######################################################################### |
|
7176 |
|
7177 @pyqtSlot() |
|
7178 def __clearByteCodeCaches(self, directory=None): |
|
7179 """ |
|
7180 Private method to recursively clear the byte code caches of a given directory. |
|
7181 |
|
7182 Note: The byte code cache directories are named '__pycache__'. |
|
7183 |
|
7184 @param directory directory name to clear byte code caches from (defaults to |
|
7185 None) |
|
7186 @type str (optional) |
|
7187 """ |
|
7188 if directory is None: |
|
7189 # When directory is 'None', we were called by the QAction. |
|
7190 if self.ppath: |
|
7191 directory = self.ppath |
|
7192 else: |
|
7193 return |
|
7194 |
|
7195 # step 1: delete the __pycache__ directory |
|
7196 cacheDir = os.path.join(directory, "__pycache__") |
|
7197 if os.path.exists(cacheDir): |
|
7198 shutil.rmtree(cacheDir, ignore_errors=True) |
|
7199 |
|
7200 # step 2: descent into subdirectories |
|
7201 with os.scandir(directory) as dirEntriesIterator: |
|
7202 for dirEntry in dirEntriesIterator: |
|
7203 if dirEntry.is_dir(): |
|
7204 self.__clearByteCodeCaches(dirEntry.path) |
|
7205 |
7155 |
7206 |
7156 # |
7207 # |
7157 # eflag: noqa = M601 |
7208 # eflag: noqa = M601 |