Skip to content

Commit c8f94ed

Browse files
committed
Fix setup.py, clean code and update readme
1 parent 427f1ba commit c8f94ed

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ In case of development, install it from cloned sources:
4949
2. Specify the `--user` option to install locally into your home directory (export "~/.local/bin" into PATH variable if haven't).
5050
3. Run the command in a [virtualenv](https://virtualenv.pypa.io/en/latest/) local to a specific project working set.
5151

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

@@ -117,8 +121,8 @@ if devices:
117121
print(str(e))
118122
```
119123

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

124128
```python
@@ -150,8 +154,8 @@ DEBUG:MBOOT:USB:Close Interface
150154
[ mboot ] Tool
151155
--------------
152156

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

157161
``` bash

mboot/mcuboot.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def _check_response(self, cmd_packet: CmdPacket, cmd_response: CmdResponse, logg
8282
cmd_name = CommandTag[cmd_packet.header.tag]
8383

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

8787
self._status_code = cmd_response.status_code
8888

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

@@ -189,7 +189,7 @@ def _send_data(self, cmd_tag: int, data: bytes) -> bool:
189189
logger.debug('RX-PACKET: ' + str(response))
190190
self._status_code = response.status_code
191191
if response.status_code != StatusCode.SUCCESS:
192-
logger.debug(f"CMD: Send Error, " + self.status_info)
192+
logger.debug("CMD: Send Error, " + self.status_info)
193193
if self._cmd_exception:
194194
raise McuBootCommandError(CommandTag[cmd_tag], self.status_code)
195195
return False

setup.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
from os import path
11-
from setuptools import setup
11+
from setuptools import setup, find_packages
1212
from mboot import __version__, __license__, __author__, __contact__
1313

1414

@@ -43,15 +43,15 @@ def get_long_description():
4343
'Programming Language :: Python :: 3.6',
4444
'Programming Language :: Python :: 3.7',
4545
'Programming Language :: Python :: 3.8',
46-
'Operating System :: POSIX :: Linux',
46+
'License :: OSI Approved :: BSD License',
4747
'Operating System :: Microsoft :: Windows',
48+
'Operating System :: POSIX :: Linux',
4849
'Environment :: Console',
49-
'License :: OSI Approved :: BSD License',
5050
'Topic :: Scientific/Engineering',
5151
'Topic :: Software Development :: Embedded Systems',
5252
'Topic :: Utilities',
5353
],
54-
packages=['mboot'],
54+
packages=find_packages('.'),
5555
entry_points={
5656
'console_scripts': [
5757
'mboot = mboot.__main__:main',

0 commit comments

Comments
 (0)