Skip to content

Commit

Permalink
Fix setup.py, clean code and update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
molejar committed Jan 6, 2020
1 parent 427f1ba commit c8f94ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ In case of development, install it from cloned sources:
2. Specify the `--user` option to install locally into your home directory (export "~/.local/bin" into PATH variable if haven't).
3. Run the command in a [virtualenv](https://virtualenv.pypa.io/en/latest/) local to a specific project working set.

> For running `mboot` module or CLI without root privileges in Linux OS copy following udev rules
[90-imx-sdp.rules](https://github.com/molejar/pyIMX/blob/master/udev/90-imx-sdp.rules)
into `/etc/udev/rules.d` directory and reload it with command: `sudo udevadm control --reload-rules`.

Usage
-----

Expand Down Expand Up @@ -117,8 +121,8 @@ if devices:
print(str(e))
```

`mboot` module is implementing also logging functionality for easy debugging of communication interfaces. All what you
need to do is just import `logging` module and set the logging level (`DEBUG` or `INFO`) with following line of code:
`mboot` module is implementing also logging functionality for easy debugging all communication interfaces. To get it
working you need only import `logging` module and set the logging level (`DEBUG` or `INFO`) with following line of code:
`logging.basicConfig(level=logging.DEBUG)`

```python
Expand Down Expand Up @@ -150,8 +154,8 @@ DEBUG:MBOOT:USB:Close Interface
[ mboot ] Tool
--------------

pyMBoot is distributed with command-line utility `mboot`, which demonstrate the complete functionality of this library and
can be used as replacement of `blhos` tool. If you write `mboot` into shell and click enter, then you get the description
The `mboot` module is distributed with command-line utility, which demonstrate the complete functionality of this library
and can be used as replacement of `blhos` tool. If you write `mboot` into shell and click enter, then you get the description
of its usage. For getting the help of individual commands just use `mboot <command name> -?`.

``` bash
Expand Down
6 changes: 3 additions & 3 deletions mboot/mcuboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _check_response(self, cmd_packet: CmdPacket, cmd_response: CmdResponse, logg
cmd_name = CommandTag[cmd_packet.header.tag]

if not isinstance(cmd_response, CmdResponse):
raise McuBootError(f"CMD: {cmd_name} Error: Unsupported response format")
raise McuBootError(f"CMD: {cmd_name} -> Unsupported response format")

self._status_code = cmd_response.status_code

Expand Down Expand Up @@ -158,7 +158,7 @@ def _read_data(self, cmd_tag: int, length: int, timeout: int = 1000) -> bytes:
if len(data) < length or self.status_code != StatusCode.SUCCESS:
logger.debug(f"CMD: Received {len(data)} from {length} Bytes, {self.status_info}")
if self._cmd_exception:
raise McuBootCommandError(CommandTag[cmd_tag], response.status_code)
raise McuBootCommandError(CommandTag[cmd_tag], self.status_code)
else:
logger.info(f"CMD: Successfully Received {len(data)} from {length} Bytes")

Expand Down Expand Up @@ -189,7 +189,7 @@ def _send_data(self, cmd_tag: int, data: bytes) -> bool:
logger.debug('RX-PACKET: ' + str(response))
self._status_code = response.status_code
if response.status_code != StatusCode.SUCCESS:
logger.debug(f"CMD: Send Error, " + self.status_info)
logger.debug("CMD: Send Error, " + self.status_info)
if self._cmd_exception:
raise McuBootCommandError(CommandTag[cmd_tag], self.status_code)
return False
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


from os import path
from setuptools import setup
from setuptools import setup, find_packages
from mboot import __version__, __license__, __author__, __contact__


Expand Down Expand Up @@ -43,15 +43,15 @@ def get_long_description():
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Operating System :: POSIX :: Linux',
'License :: OSI Approved :: BSD License',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Environment :: Console',
'License :: OSI Approved :: BSD License',
'Topic :: Scientific/Engineering',
'Topic :: Software Development :: Embedded Systems',
'Topic :: Utilities',
],
packages=['mboot'],
packages=find_packages('.'),
entry_points={
'console_scripts': [
'mboot = mboot.__main__:main',
Expand Down

0 comments on commit c8f94ed

Please sign in to comment.