Description: use the packaged version of uflash.py
 During repacking of the upstream source we remove the convenience copy of
 uflash.py, which is provided on Debian in the python3-uflash package
Author: Nick Morrott <knowledgejunkie@gmail.com>
Forwarded: not-needed
Last-Update: 2018-12-21
---
Index: mu-editor/mu/modes/microbit.py
===================================================================
--- mu-editor.orig/mu/modes/microbit.py
+++ mu-editor/mu/modes/microbit.py
@@ -26,7 +26,8 @@ import semver
 from PyQt5.QtCore import QThread, pyqtSignal
 
 from mu.logic import sniff_newline_convention
-from mu.contrib import uflash, microfs
+import uflash
+from mu.contrib import microfs
 from mu.modes.api import MICROBIT_APIS, SHARED_APIS
 from mu.modes.base import MicroPythonMode, FileManager
 from mu.interface.panes import CHARTS
Index: mu-editor/tests/modes/test_microbit.py
===================================================================
--- mu-editor.orig/tests/modes/test_microbit.py
+++ mu-editor/tests/modes/test_microbit.py
@@ -9,7 +9,7 @@ from mu.config import HOME_DIRECTORY
 from mu.logic import Device
 from mu.modes.microbit import MicrobitMode, DeviceFlasher, can_minify
 from mu.modes.api import MICROBIT_APIS, SHARED_APIS
-from mu.contrib import uflash
+import uflash
 from unittest import mock
 from tokenize import TokenError
 
@@ -56,7 +56,7 @@ def test_DeviceFlasher_run():
     """
     df = DeviceFlasher("path", "script", None)
     mock_flash = mock.MagicMock()
-    with mock.patch("mu.modes.microbit.uflash", mock_flash):
+    with mock.patch("uflash", mock_flash):
         df.run()
     mock_flash.flash.assert_called_once_with(
         paths_to_microbits=["path"], python_script="script"
@@ -71,7 +71,7 @@ def test_DeviceFlasher_run_fail():
     df.on_flash_fail = mock.MagicMock()
     mock_flash = mock.MagicMock()
     mock_flash.flash.side_effect = Exception("Boom")
-    with mock.patch("mu.modes.microbit.uflash", mock_flash):
+    with mock.patch("uflash", mock_flash):
         df.run()
     df.on_flash_fail.emit.assert_called_once_with(str(Exception("Boom")))
 
@@ -147,7 +147,7 @@ def test_flash_with_attached_device_has_
         "machine": "micro:bit with nRF51822",
     }
     with mock.patch(
-        "mu.modes.microbit.uflash.find_microbit", return_value="/path/microbit"
+        "uflash.find_microbit", return_value="/path/microbit"
     ), mock.patch(
         "mu.modes.microbit.microfs.version", return_value=version_info
     ), mock.patch(
@@ -185,7 +185,7 @@ def test_flash_with_attached_device_has_
         "machine": "micro:bit with nRF52833",
     }
     with mock.patch(
-        "mu.modes.microbit.uflash.find_microbit", return_value="/path/microbit"
+        "uflash.find_microbit", return_value="/path/microbit"
     ), mock.patch(
         "mu.modes.microbit.microfs.version", return_value=version_info
     ), mock.patch(
@@ -225,7 +225,7 @@ def test_flash_device_has_latest_firmwar
     mock_flasher = mock.MagicMock()
     mock_flasher_class = mock.MagicMock(return_value=mock_flasher)
     with mock.patch(
-        "mu.modes.microbit.uflash.find_microbit", return_value="/path/microbit"
+        "uflash.find_microbit", return_value="/path/microbit"
     ), mock.patch(
         "mu.modes.microbit.microfs.version", return_value=version_info
     ), mock.patch(
@@ -278,7 +278,7 @@ def test_flash_with_attached_device_has_
     mock_flasher = mock.MagicMock()
     mock_flasher_class = mock.MagicMock(return_value=mock_flasher)
     with mock.patch(
-        "mu.modes.microbit.uflash.find_microbit", return_value="/path/microbit"
+        "uflash.find_microbit", return_value="/path/microbit"
     ), mock.patch(
         "mu.modes.microbit.microfs.version", return_value=version_info
     ), mock.patch(
@@ -318,7 +318,7 @@ def test_flash_with_attached_device_has_
     mock_flasher = mock.MagicMock()
     mock_flasher_class = mock.MagicMock(return_value=mock_flasher)
     with mock.patch(
-        "mu.modes.microbit.uflash.find_microbit", return_value="/path/microbit"
+        "uflash.find_microbit", return_value="/path/microbit"
     ), mock.patch(
         "mu.modes.microbit.microfs.version", return_value=version_info
     ), mock.patch(
@@ -364,7 +364,7 @@ def test_flash_force_with_no_micropython
     mock_flasher = mock.MagicMock()
     mock_flasher_class = mock.MagicMock(return_value=mock_flasher)
     with mock.patch(
-        "mu.modes.microbit.uflash.find_microbit", return_value="bar"
+        "uflash.find_microbit", return_value="bar"
     ), mock.patch(
         "mu.modes.microbit.microfs.version", side_effect=ValueError("bang")
     ), mock.patch(
@@ -412,7 +412,7 @@ def test_flash_force_with_unsupported_mi
     mock_flasher = mock.MagicMock()
     mock_flasher_class = mock.MagicMock(return_value=mock_flasher)
     with mock.patch(
-        "mu.modes.microbit.uflash.find_microbit", return_value="bar"
+        "uflash.find_microbit", return_value="bar"
     ), mock.patch(
         "mu.modes.microbit.microfs.version", side_effect=ValueError("bang")
     ), mock.patch(
@@ -452,7 +452,7 @@ def test_flash_force_with_attached_devic
     mock_flasher = mock.MagicMock()
     mock_flasher_class = mock.MagicMock(return_value=mock_flasher)
     with mock.patch(
-        "mu.modes.microbit.uflash.find_microbit", return_value="/foo/microbit/"
+        "uflash.find_microbit", return_value="/foo/microbit/"
     ), mock.patch(
         "mu.modes.microbit.microfs.version", return_value=version_info
     ), mock.patch(
@@ -504,7 +504,7 @@ def test_flash_with_attached_device_and_
     with mock.patch(
         "mu.modes.base.BaseMode.workspace_dir", return_value=TEST_ROOT
     ), mock.patch(
-        "mu.modes.microbit.uflash.find_microbit", return_value="/foo/microbit/"
+        "uflash.find_microbit", return_value="/foo/microbit/"
     ), mock.patch(
         "mu.modes.microbit.os.path.isfile", return_value=True
     ), mock.patch(
@@ -565,7 +565,7 @@ def test_flash_with_attached_known_devic
     mock_flasher = mock.MagicMock()
     mock_flasher_class = mock.MagicMock(return_value=mock_flasher)
     with mock.patch(
-        "mu.modes.microbit.uflash.find_microbit", return_value="/bar/microbit"
+        "uflash.find_microbit", return_value="/bar/microbit"
     ), mock.patch(
         "mu.modes.microbit.microfs.version", return_value=version_info
     ), mock.patch(
