17 import trove_classifiers |
17 import trove_classifiers |
18 |
18 |
19 from PyQt6.QtCore import Qt, pyqtSlot |
19 from PyQt6.QtCore import Qt, pyqtSlot |
20 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QListWidgetItem, QTreeWidgetItem |
20 from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QListWidgetItem, QTreeWidgetItem |
21 |
21 |
22 from eric7 import Preferences, Utilities |
22 from eric7 import Preferences |
23 from eric7.EricWidgets import EricFileDialog |
23 from eric7.EricWidgets import EricFileDialog |
24 from eric7.EricWidgets.EricApplication import ericApp |
24 from eric7.EricWidgets.EricApplication import ericApp |
25 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
25 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes |
|
26 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities |
26 |
27 |
27 from .AddEntryPointDialog import AddEntryPointDialog |
28 from .AddEntryPointDialog import AddEntryPointDialog |
28 from .AddProjectUrlDialog import AddProjectUrlDialog |
29 from .AddProjectUrlDialog import AddProjectUrlDialog |
29 from .Ui_SetupWizardDialog import Ui_SetupWizardDialog |
30 from .Ui_SetupWizardDialog import Ui_SetupWizardDialog |
30 |
31 |
398 sourceCode += '{0}python_requires="{1}",{2}'.format( |
399 sourceCode += '{0}python_requires="{1}",{2}'.format( |
399 istring, self.pyVersionEdit.text(), os.linesep |
400 istring, self.pyVersionEdit.text(), os.linesep |
400 ) |
401 ) |
401 |
402 |
402 sourceCode += "{0}packages=find_packages(".format(istring) |
403 sourceCode += "{0}packages=find_packages(".format(istring) |
403 src = Utilities.fromNativeSeparators(self.sourceDirectoryPicker.text()) |
404 src = FileSystemUtilities.fromNativeSeparators( |
|
405 self.sourceDirectoryPicker.text() |
|
406 ) |
404 excludePatterns = [] |
407 excludePatterns = [] |
405 for row in range(self.excludePatternList.count()): |
408 for row in range(self.excludePatternList.count()): |
406 excludePatterns.append(self.excludePatternList.item(row).text()) |
409 excludePatterns.append(self.excludePatternList.item(row).text()) |
407 if src: |
410 if src: |
408 sourceCode += '{0}{1}"{2}"'.format(os.linesep, i1string, src) |
411 sourceCode += '{0}{1}"{2}"'.format(os.linesep, i1string, src) |
552 |
555 |
553 if self.pyVersionEdit.text(): |
556 if self.pyVersionEdit.text(): |
554 options["python_requires"] = self.pyVersionEdit.text() |
557 options["python_requires"] = self.pyVersionEdit.text() |
555 |
558 |
556 findOptions = {} |
559 findOptions = {} |
557 src = Utilities.fromNativeSeparators(self.sourceDirectoryPicker.text()) |
560 src = FileSystemUtilities.fromNativeSeparators( |
|
561 self.sourceDirectoryPicker.text() |
|
562 ) |
558 excludePatterns = [] |
563 excludePatterns = [] |
559 for row in range(self.excludePatternList.count()): |
564 for row in range(self.excludePatternList.count()): |
560 excludePatterns.append(self.excludePatternList.item(row).text()) |
565 excludePatterns.append(self.excludePatternList.item(row).text()) |
561 if src: |
566 if src: |
562 options["package_dir"] = SetupCfgUtilities.toString({"": src}) |
567 options["package_dir"] = SetupCfgUtilities.toString({"": src}) |
769 modulesArray.add_line(self.modulesList.item(row).text()) |
774 modulesArray.add_line(self.modulesList.item(row).text()) |
770 modulesArray.append(tomlkit.nl()) |
775 modulesArray.append(tomlkit.nl()) |
771 setuptools["py-modules"] = modulesArray |
776 setuptools["py-modules"] = modulesArray |
772 |
777 |
773 findspec = tomlkit.table() |
778 findspec = tomlkit.table() |
774 src = Utilities.fromNativeSeparators(self.sourceDirectoryPicker.text()) |
779 src = FileSystemUtilities.fromNativeSeparators( |
|
780 self.sourceDirectoryPicker.text() |
|
781 ) |
775 excludePatterns = [] |
782 excludePatterns = [] |
776 for row in range(self.excludePatternList.count()): |
783 for row in range(self.excludePatternList.count()): |
777 excludePatterns.append(self.excludePatternList.item(row).text()) |
784 excludePatterns.append(self.excludePatternList.item(row).text()) |
778 if src: |
785 if src: |
779 findspec["where"] = [ericApp().getObject("Project").getRelativePath(src)] |
786 findspec["where"] = [ericApp().getObject("Project").getRelativePath(src)] |
860 Private method to get the start directory for selection dialogs. |
867 Private method to get the start directory for selection dialogs. |
861 |
868 |
862 @return start directory |
869 @return start directory |
863 @rtype str |
870 @rtype str |
864 """ |
871 """ |
865 return Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() |
872 return Preferences.getMultiProject("Workspace") or OSUtilities.getHomeDir() |
866 |
873 |
867 @pyqtSlot() |
874 @pyqtSlot() |
868 def on_entryPointsList_itemSelectionChanged(self): |
875 def on_entryPointsList_itemSelectionChanged(self): |
869 """ |
876 """ |
870 Private slot to handle a change of selected items of the |
877 Private slot to handle a change of selected items of the |
949 self.tr("Add Python Modules"), |
956 self.tr("Add Python Modules"), |
950 startDir, |
957 startDir, |
951 self.tr("Python Files (*.py)"), |
958 self.tr("Python Files (*.py)"), |
952 ) |
959 ) |
953 for module in modulesList: |
960 for module in modulesList: |
954 module = module.replace(Utilities.toNativeSeparators(startDir), "") |
961 module = module.replace( |
|
962 FileSystemUtilities.toNativeSeparators(startDir), "" |
|
963 ) |
955 if module.startswith(("\\", "/")): |
964 if module.startswith(("\\", "/")): |
956 module = module[1:] |
965 module = module[1:] |
957 if module: |
966 if module: |
958 QListWidgetItem( |
967 QListWidgetItem( |
959 str(pathlib.Path(module).with_suffix("")) |
968 str(pathlib.Path(module).with_suffix("")) |