MicroPython eric7

Sat, 31 Aug 2024 17:19:33 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 31 Aug 2024 17:19:33 +0200
branch
eric7
changeset 10900
4139f17d07ad
parent 10899
3d32490ebde4
child 10901
07b5cc115d09

MicroPython
- Adapted the CircuitPython library management to later versions of circup.

src/eric7/Documentation/Help/source.qch file | annotate | diff | comparison | revisions
src/eric7/Documentation/Source/eric7.MicroPython.Devices.CircuitPythonUpdater.CircupFunctions.html file | annotate | diff | comparison | revisions
src/eric7/MicroPython/Devices/CircuitPythonUpdater/CircuitPythonUpdaterInterface.py file | annotate | diff | comparison | revisions
src/eric7/MicroPython/Devices/CircuitPythonUpdater/CircupFunctions.py file | annotate | diff | comparison | revisions
src/eric7/MicroPython/Devices/CircuitPythonUpdater/ShowInstalledDialog.py file | annotate | diff | comparison | revisions
src/eric7/MicroPython/Devices/CircuitPythonUpdater/ShowOutdatedDialog.py file | annotate | diff | comparison | revisions
Binary file src/eric7/Documentation/Help/source.qch has changed
--- a/src/eric7/Documentation/Source/eric7.MicroPython.Devices.CircuitPythonUpdater.CircupFunctions.html	Sat Aug 31 15:55:04 2024 +0200
+++ b/src/eric7/Documentation/Source/eric7.MicroPython.Devices.CircuitPythonUpdater.CircupFunctions.html	Sat Aug 31 17:19:33 2024 +0200
@@ -76,9 +76,9 @@
 
 <dl>
 
-<dt><i>device_path</i> (str)</dt>
+<dt><i>device_path</i> (str or circup.DiskBackend)</dt>
 <dd>
-path to the connected board
+path to the connected board or a disk backend object
 </dd>
 <dt><i>bundles_list</i> (list of circup.Bundle)</dt>
 <dd>
--- a/src/eric7/MicroPython/Devices/CircuitPythonUpdater/CircuitPythonUpdaterInterface.py	Sat Aug 31 15:55:04 2024 +0200
+++ b/src/eric7/MicroPython/Devices/CircuitPythonUpdater/CircuitPythonUpdaterInterface.py	Sat Aug 31 17:19:33 2024 +0200
@@ -527,6 +527,7 @@
         @type list of str
         """
         devicePath = self.__device.getWorkspace()
+        backend = circup.DiskBackend(devicePath, circup.logger)
 
         cpyVersion, _board_id = circup.get_circuitpython_version(devicePath)
         circup.CPY_VERSION = cpyVersion
@@ -537,7 +538,7 @@
             for module, metadata in availableModules.items():
                 moduleNames[module.replace(".py", "")] = metadata
             toBeInstalled = circup.get_dependencies(installs, mod_names=moduleNames)
-            deviceModules = circup.get_device_versions(devicePath)
+            deviceModules = backend.get_device_versions()
         if toBeInstalled is not None:
             dependencies = [m for m in toBeInstalled if m not in installs]
             ok = EricMessageBox.yesNo(
@@ -609,7 +610,8 @@
         libraryPath = os.path.join(devicePath, "lib")
 
         with EricOverrideCursor():
-            deviceModules = circup.get_device_versions(devicePath)
+            backend = circup.DiskBackend(devicePath, circup.logger)
+            deviceModules = backend.get_device_versions()
         modNames = {}
         for moduleItem, metadata in deviceModules.items():
             modNames[moduleItem.replace(".py", "").lower()] = metadata
--- a/src/eric7/MicroPython/Devices/CircuitPythonUpdater/CircupFunctions.py	Sat Aug 31 15:55:04 2024 +0200
+++ b/src/eric7/MicroPython/Devices/CircuitPythonUpdater/CircupFunctions.py	Sat Aug 31 17:19:33 2024 +0200
@@ -29,17 +29,21 @@
     Function to extract metadata from the connected device and available bundles and
     returns this as a list of Module instances representing the modules on the device.
 
-    @param device_path path to the connected board
-    @type str
+    @param device_path path to the connected board or a disk backend object
+    @type str or circup.DiskBackend
     @param bundles_list list of supported bundles
     @type list of circup.Bundle
     @return list of Module instances describing the current state of the
         modules on the connected device
     @rtype list of circup.Module
     """
+    if isinstance(device_path, str):
+        backend = circup.DiskBackend(device_path, circup.logger)
+    else:
+        backend = device_path
     result = []
     try:
-        device_modules = circup.get_device_versions(device_path)
+        device_modules = backend.get_device_versions()
         bundle_modules = circup.get_bundle_versions(bundles_list)
         for name, device_metadata in device_modules.items():
             if name in bundle_modules:
--- a/src/eric7/MicroPython/Devices/CircuitPythonUpdater/ShowInstalledDialog.py	Sat Aug 31 15:55:04 2024 +0200
+++ b/src/eric7/MicroPython/Devices/CircuitPythonUpdater/ShowInstalledDialog.py	Sat Aug 31 17:19:33 2024 +0200
@@ -32,8 +32,9 @@
         super().__init__(parent)
         self.setupUi(self)
 
+        backend = circup.DiskBackend(devicePath, circup.logger)
         self.modulesList.clear()
-        deviceModules = circup.get_device_versions(devicePath)
+        deviceModules = backend.get_device_versions()
         for name, metadata in deviceModules.items():
             QTreeWidgetItem(
                 self.modulesList,
--- a/src/eric7/MicroPython/Devices/CircuitPythonUpdater/ShowOutdatedDialog.py	Sat Aug 31 15:55:04 2024 +0200
+++ b/src/eric7/MicroPython/Devices/CircuitPythonUpdater/ShowOutdatedDialog.py	Sat Aug 31 17:19:33 2024 +0200
@@ -49,9 +49,10 @@
         else:
             self.buttonBox.setStandardButtons(QDialogButtonBox.StandardButton.Close)
 
+        backend = circup.DiskBackend(devicePath, circup.logger)
         self.__modules = {
             m.name: m
-            for m in circup.find_modules(devicePath, circup.get_bundles_list())
+            for m in circup.find_modules(backend, circup.get_bundles_list())
             if m.outofdate
         }
         if self.__modules:

eric ide

mercurial