Skip to content

Commit f7ca33a

Browse files
Merge branch 'master' into initial_flake8_test_module
2 parents 67eca78 + 136409c commit f7ca33a

File tree

4 files changed

+41
-10
lines changed

4 files changed

+41
-10
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# Mbed OS Tools
22

3-
This repository contains the python modules needed to work with Mbed OS. **The APIs in this repository are not stable**, as indicated by the 0.x.x semantic version. For this reason, it is recommened to continue using the existing python packages: [mbed-ls](https://github.com/ARMmbed/mbed-os-tools/tree/master/legacy/mbed-ls), [mbed-host-tests](https://github.com/ARMmbed/mbed-os-tools/tree/master/legacy/mbed-host-tests), and [mbed-greentea](https://github.com/ARMmbed/mbed-os-tools/tree/master/legacy/mbed-greentea).
3+
This repository contains the python modules needed to work with Mbed OS. Historically, the Mbed OS tools have been delivered in separate packages and repositories. Their APIs have evolved separately over time, each with their own style and syntax. This project is working to unify these packages into a single intuitive API.
44

5-
To contribute changes to these packages, please commit them to this repository. The mapping of these packages to the `mbed-os-tools` modules is as follows:
5+
## Packages
66

7-
- mbed-ls - `src/mbed_os_tools/detect` for the implementation, `test/detect` for the tests
8-
- mbed-greentea - `src/mbed_os_tools/test` for the implementation, `test/test` for the tests
9-
- mbed-host-tests - `src/mbed_os_tools/test` for the implementation, `test/test` for the tests
7+
Below is a table showing what packages are delivered from this repository:
8+
9+
| PyPI Package | Source | Depends on | Stable API |
10+
| ------- | ------ | ---------- | ---------- |
11+
| mbed-os-tools | `src/` | | **No** |
12+
| mbed-ls | `legacy/mbed-ls/` | mbed-os-tools | **Yes** |
13+
| mbed-host-tests | `legacy/mbed-host-tests/` | mbed-os-tools | **Yes** |
14+
| mbed-greentea | `legacy/mbed-greentea/` | mbed-os-tools | **Yes** |
15+
16+
As indicated above, **the API provided by `mbed-os-tools` is not stable**. For this reason, please continue to use the other packages.
1017

1118
## License and contributions
1219

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ def read(fname):
4646
install_requires=[
4747
"PySerial>=3.0",
4848
"requests",
49-
"pyocd==0.14.0",
5049
"intelhex",
5150
"future",
5251
"PrettyTable>=0.7.2",
@@ -58,5 +57,7 @@ def read(fname):
5857
"colorama>=0.3,<0.5",
5958
],
6059
tests_require=["mock>=2", "pytest>=3"],
61-
extras_require={"colorized_logs": ["colorlog"]},
60+
extras_require={
61+
"pyocd": ["pyocd==0.14.0"]
62+
},
6263
)

src/mbed_os_tools/test/host_tests_plugins/module_copy_pyocd.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515

1616
import os
1717
from .host_test_plugins import HostTestPluginBase
18-
from pyocd.core.helpers import ConnectHelper
19-
from pyocd.flash.loader import FileProgrammer
2018

19+
try:
20+
from pyocd.core.helpers import ConnectHelper
21+
from pyocd.flash.loader import FileProgrammer
22+
PYOCD_PRESENT = True
23+
except ImportError:
24+
PYOCD_PRESENT = False
2125

2226
class HostTestPluginCopyMethod_pyOCD(HostTestPluginBase):
2327
# Plugin interface
@@ -44,6 +48,13 @@ def execute(self, capability, *args, **kwargs):
4448
@param kwargs Additional arguments
4549
@return Capability call return value
4650
"""
51+
if not PYOCD_PRESENT:
52+
self.print_plugin_error(
53+
'The "pyocd" feature is not installed. Please run '
54+
'"pip install mbed-os-tools[pyocd]" to enable the "pyocd" copy plugin.'
55+
)
56+
return False
57+
4758
if not self.check_parameters(capability, *args, **kwargs):
4859
return False
4960

src/mbed_os_tools/test/host_tests_plugins/module_reset_pyocd.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414
# limitations under the License.
1515

1616
from .host_test_plugins import HostTestPluginBase
17-
from pyocd.core.helpers import ConnectHelper
17+
18+
try:
19+
from pyocd.core.helpers import ConnectHelper
20+
PYOCD_PRESENT = True
21+
except ImportError:
22+
PYOCD_PRESENT = False
1823

1924

2025
class HostTestPluginResetMethod_pyOCD(HostTestPluginBase):
@@ -48,6 +53,13 @@ def execute(self, capability, *args, **kwargs):
4853
@details Each capability e.g. may directly just call some command line program or execute building pythonic function
4954
@return Capability call return value
5055
"""
56+
if not PYOCD_PRESENT:
57+
self.print_plugin_error(
58+
'The "pyocd" feature is not installed. Please run '
59+
'"pip install mbed-os-tools[pyocd]" to enable the "pyocd" reset plugin.'
60+
)
61+
return False
62+
5163
if not kwargs['target_id']:
5264
self.print_plugin_error("Error: target_id not set")
5365
return False

0 commit comments

Comments
 (0)