Adapted some import statements to eric 23.1 and newer. eric7 release-10.2.0

Wed, 21 Dec 2022 09:03:33 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 21 Dec 2022 09:03:33 +0100
branch
eric7
changeset 142
9ceff8a10455
parent 141
d0172af094d8
child 143
74086ef8ee18

Adapted some import statements to eric 23.1 and newer.

ChangeLog file | annotate | diff | comparison | revisions
CxFreeze/CxfreezeConfigDialog.py file | annotate | diff | comparison | revisions
CxFreeze/CxfreezeExecDialog.py file | annotate | diff | comparison | revisions
PluginCxFreeze.epj file | annotate | diff | comparison | revisions
PluginCxFreeze.py file | annotate | diff | comparison | revisions
PluginCxFreeze.zip file | annotate | diff | comparison | revisions
pyproject.toml file | annotate | diff | comparison | revisions
--- a/ChangeLog	Tue Oct 25 09:03:43 2022 +0200
+++ b/ChangeLog	Wed Dec 21 09:03:33 2022 +0100
@@ -1,5 +1,8 @@
 ChangeLog
 ---------
+Version 10.2.0
+- adapted some import statements to eric 23.1 and newer
+
 Version 10.1.0
 - adapted the import statements to the new structure
 
--- a/CxFreeze/CxfreezeConfigDialog.py	Tue Oct 25 09:03:43 2022 +0200
+++ b/CxFreeze/CxfreezeConfigDialog.py	Wed Dec 21 09:03:33 2022 +0100
@@ -7,23 +7,33 @@
 Module implementing a dialog to enter the parameters for cxfreeze.
 """
 
-import sys
+import contextlib
+import copy
 import os
-import copy
-import contextlib
+import sys
 
-from PyQt6.QtCore import pyqtSlot, QDir, QProcess
+from PyQt6.QtCore import QDir, QProcess, pyqtSlot
 from PyQt6.QtWidgets import QDialog, QListWidgetItem
 
-from eric7 import Utilities
-
 try:
     from eric7.EricGui import EricPixmapCache
 except ImportError:
     from UI import PixmapCache as EricPixmapCache
+
 from eric7.EricWidgets.EricDirFileDialog import EricDirFileDialog
 from eric7.EricWidgets.EricPathPicker import EricPathPickerModes
 
+try:
+    from eric7.SystemUtilities.OSUtilities import isMacPlatform, isWindowsPlatform
+except ImportError:
+    # imports for eric < 23.1
+    from eric7.Globals import isMacPlatform, isWindowsPlatform
+try:
+    from eric7.SystemUtilities.FileSystemUtilities import toNativeSeparators
+except ImportError:
+    # imports for eric < 23.1
+    from eric7.Utilities import toNativeSeparators
+
 from .Ui_CxfreezeConfigDialog import Ui_CxfreezeConfigDialog
 
 
@@ -55,9 +65,9 @@
 
         iconsI18N = self.tr("Icons")
         allFilesI18N = self.tr("All files")
-        if Utilities.isWindowsPlatform():
+        if isWindowsPlatform():
             iconFilter = "{0} (*.ico);;{1} (*.*)".format(iconsI18N, allFilesI18N)
-        elif Utilities.isMacPlatform():
+        elif isMacPlatform():
             iconFilter = "{0} (*.icns *.png);;{1} (*.*)".format(iconsI18N, allFilesI18N)
         else:
             iconFilter = "{0} (*.png);;{1} (*.*)".format(iconsI18N, allFilesI18N)
@@ -253,7 +263,7 @@
         @type str
         """
         # version specific setup
-        if Utilities.isWindowsPlatform():
+        if isWindowsPlatform():
             # remove "\Scripts\cx_Freeze.bat" from path
             dirname = os.path.dirname(text)
             dirname = os.path.dirname(dirname)
@@ -296,7 +306,7 @@
         if modpath:
             d = QDir(os.path.join(modpath, "bases"))
             basesList = d.entryList(QDir.Filter.Files)
-            if Utilities.isWindowsPlatform():
+            if isWindowsPlatform():
                 # strip the final '.exe' from the bases
                 tmpBasesList = basesList[:]
                 basesList = []
@@ -396,7 +406,7 @@
 
         for itm in items:
             itm = self.__project.getRelativePath(itm)
-            self.fileOrFolderList.addItem(Utilities.toNativeSeparators(itm))
+            self.fileOrFolderList.addItem(toNativeSeparators(itm))
         row = self.fileOrFolderList.currentRow()
         self.on_fileOrFolderList_currentRowChanged(row)
 
--- a/CxFreeze/CxfreezeExecDialog.py	Tue Oct 25 09:03:43 2022 +0200
+++ b/CxFreeze/CxfreezeExecDialog.py	Wed Dec 21 09:03:33 2022 +0100
@@ -7,13 +7,13 @@
 Module implementing a dialog to show the output of the packager process.
 """
 
-import shutil
 import errno
 import fnmatch
 import os.path
+import shutil
 
-from PyQt6.QtCore import pyqtSlot, QProcess, QTimer, QThread, pyqtSignal
-from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton
+from PyQt6.QtCore import QProcess, QThread, QTimer, pyqtSignal, pyqtSlot
+from PyQt6.QtWidgets import QAbstractButton, QDialog, QDialogButtonBox
 
 from eric7 import Preferences
 from eric7.EricWidgets import EricMessageBox
--- a/PluginCxFreeze.epj	Tue Oct 25 09:03:43 2022 +0200
+++ b/PluginCxFreeze.epj	Wed Dec 21 09:03:33 2022 +0100
@@ -189,7 +189,8 @@
       "CxFreeze/Documentation/source",
       "PKGLIST",
       "PluginCxFreeze.epj",
-      "PluginCxFreeze.zip"
+      "PluginCxFreeze.zip",
+      "pyproject.toml"
     ],
     "OTHERTOOLSPARMS": {
       "Black": {
@@ -207,6 +208,23 @@
           "py38",
           "py37"
         ]
+      },
+      "isort": {
+        "combine_as_imports": true,
+        "config_source": "project",
+        "extend_skip_glob": [
+          "*/Ui_*.py"
+        ],
+        "lines_between_types": 1,
+        "profile": "black",
+        "sort_order": "natural",
+        "supported_extensions": [
+          "py",
+          "pyi",
+          "pyx",
+          "pxd",
+          "pyw"
+        ]
       }
     },
     "PACKAGERSPARMS": {},
--- a/PluginCxFreeze.py	Tue Oct 25 09:03:43 2022 +0200
+++ b/PluginCxFreeze.py	Wed Dec 21 09:03:33 2022 +0100
@@ -10,20 +10,26 @@
 import os
 import platform
 
-from PyQt6.QtCore import QObject, QTranslator, QCoreApplication, QProcess
+from PyQt6.QtCore import QCoreApplication, QObject, QProcess, QTranslator
 from PyQt6.QtWidgets import QDialog
 
-from eric7 import Utilities
 from eric7.EricGui.EricAction import EricAction
 from eric7.EricWidgets import EricMessageBox
 from eric7.EricWidgets.EricApplication import ericApp
 
+try:
+    from eric7.SystemUtilities.OSUtilities import getEnvironmentEntry, isWindowsPlatform
+except ImportError:
+    # imports for eric < 23.1
+    from eric7.Globals import isWindowsPlatform
+    from eric7.Utilities import getEnvironmentEntry
+
 # Start-of-Header
 name = "CxFreeze Plugin"
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "10.1.0"
+version = "10.2.0"
 className = "CxFreezePlugin"
 packageName = "CxFreeze"
 shortDescription = "Show the CxFreeze dialogs."
@@ -86,7 +92,7 @@
         return []
 
     executables = set()
-    if Utilities.isWindowsPlatform():
+    if isWindowsPlatform():
         #
         # Windows
         #
@@ -152,7 +158,7 @@
         if not executables and majorVersion >= 3:
             # check the PATH environment variable if nothing was found
             # Python 3 only
-            path = Utilities.getEnvironmentEntry("PATH")
+            path = getEnvironmentEntry("PATH")
             if path:
                 dirs = path.split(os.pathsep)
                 for directory in dirs:
@@ -169,7 +175,7 @@
             scriptSuffixes.append("-python{0}.{1}".format(majorVersion, minorVersion))
         # There could be multiple cxfreeze executables in the path
         # e.g. for different python variants
-        path = Utilities.getEnvironmentEntry("PATH")
+        path = getEnvironmentEntry("PATH")
         # environment variable not defined
         if path is None:
             return []
@@ -218,7 +224,7 @@
 
     exePy3 = _findExecutable(3)
     if exePy3 == []:
-        if Utilities.isWindowsPlatform():
+        if isWindowsPlatform():
             error = QCoreApplication.translate(
                 "CxFreezePlugin",
                 "The cxfreeze.bat executable could not be found."
Binary file PluginCxFreeze.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pyproject.toml	Wed Dec 21 09:03:33 2022 +0100
@@ -0,0 +1,10 @@
+[tool.isort]
+profile = "black"
+sort_order = "natural"
+supported_extensions = ["py", "pyi", "pyx", "pxd", "pyw"]
+lines_between_types = 1
+extend_skip_glob = [
+    "*/Ui_*.py",
+]
+combine_as_imports = true
+known_first_party = ["CxFreeze", "eric7"]

eric ide

mercurial