Skip to content

Conversation

screamerbg
Copy link
Contributor

This PR introduces cosmetic changes to Mbed CLI to improve error and warning multi-line formatting and also the wording of some messages.

Old multi-line formatting

$ mbed compile -m DETECT
[mbed] Auto-installing missing Python modules...
[mbed] WARNING: Unable to auto-install required Python modules.
---
[mbed] WARNING: -----------------------------------------------------------------
[mbed] WARNING: The mbed OS tools in this program require the following Python modules: intelhex
[mbed] WARNING: You can install all missing modules by running "pip install -r requirements.txt" in "/private/tmp/1/mbed-os-example-blinky/mbed-os"
[mbed] WARNING: On Posix systems (Linux, Mac, etc) you might have to switch to superuser account or use "sudo"
---
[mbed] Detected "DISCO_L475VG_IOT01A" connected to "/Volumes/DIS_L4IOT" and using com port "/dev/tty.usbmodem1413"
Traceback (most recent call last):
  File "/private/tmp/1/mbed-os-example-blinky/mbed-os/tools/make.py", line 34, in <module>
    from tools.utils import args_error
  File "/private/tmp/1/mbed-os-example-blinky/mbed-os/tools/utils.py", line 32, in <module>
    from intelhex import IntelHex
ImportError: No module named intelhex
[mbed] ERROR: "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python" returned error code 1.
[mbed] ERROR: Command "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u /private/tmp/1/mbed-os-example-blinky/mbed-os/tools/make.py -t GCC_ARM -m DISCO_L475VG_IOT01A --source . --build ./BUILD/DISCO_L475VG_IOT01A/GCC_ARM" in "/private/tmp/1/mbed-os-example-blinky"
---

New multi-line formatting

$ mbed compile -m DETECT
[mbed] Auto-installing missing Python modules...
[mbed] WARNING: Unable to auto-install required Python modules.
       The mbed OS tools in this program require the following Python modules: intelhex
       You can install all missing modules by running "pip install -r requirements.txt" in "/private/tmp/1/mbed-os-example-blinky/mbed-os"
       On Posix systems (Linux, Mac, etc) you might have to switch to superuser account or use "sudo"
---
[mbed] Detected "DISCO_L475VG_IOT01A" connected to "/Volumes/DIS_L4IOT" and using com port "/dev/tty.usbmodem1413"
Traceback (most recent call last):
  File "/private/tmp/1/mbed-os-example-blinky/mbed-os/tools/make.py", line 34, in <module>
    from tools.utils import args_error
  File "/private/tmp/1/mbed-os-example-blinky/mbed-os/tools/utils.py", line 32, in <module>
    from intelhex import IntelHex
ImportError: No module named intelhex
[mbed] ERROR: "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python" returned error.
       Code: 1
       Path: "/private/tmp/1/mbed-os-example-blinky"
       Command: "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u /private/tmp/1/mbed-os-example-blinky/mbed-os/tools/make.py -t GCC_ARM -m DISCO_L475VG_IOT01A --source . --build ./BUILD/DISCO_L475VG_IOT01A/GCC_ARM"
       Tip: You could retry the last command with "-v" flag for verbose output
---

Related to #683 (comment)

CC @ansondtx20

@screamerbg screamerbg changed the title Improve warning/error formatting, various messages, language etc Improve warning/error formatting and various messages Jun 8, 2018
Copy link
Contributor

@theotherjimmy theotherjimmy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me. You should look at the Python 3 CI failures.

@screamerbg screamerbg force-pushed the f/improve-messages branch from 6182b25 to 955f127 Compare June 18, 2018 20:32
@screamerbg
Copy link
Contributor Author

@theotherjimmy Now fixed.
Bump @MarceloSalazar

@screamerbg screamerbg requested a review from cmonr June 19, 2018 10:54
Copy link
Contributor

@cmonr cmonr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a question about a new exception.

@@ -1785,6 +1788,8 @@ def formaturl(url, format="default"):
def mbed_sterm(port, baudrate=9600, echo=True, reset=False, sterm=False):
try:
from .mbed_terminal import MbedTerminal
except(ValueError): # relative import fails on Python 2 in non-package mode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. What command is used to invoke this error?

@MarceloSalazar
Copy link
Contributor

MarceloSalazar commented Jun 19, 2018

LGTM

@theotherjimmy theotherjimmy merged commit 8a3873f into ARMmbed:master Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants