Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Commit 7b54418

Browse files
authored
Merge branch 'master' into release/v6.0
2 parents 70c7a99 + 8b970cc commit 7b54418

31 files changed

+205
-177
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ This will also retrieve and install all additional required packages.
4747

4848
**Note**: Please refer to the [pc-ble-driver-py PyPI installation note on Windows](https://github.com/NordicSemiconductor/pc-ble-driver-py#installing-from-pypi) if you are running nrfutil on this operating system.
4949

50-
**Note**: When installing on macOS, you may need to add ` --ignore-installed six` when running pip. See [issue #79](https://github.com/NordicSemiconductor/pc-nrfutil/issues/79).
51-
5250
## Downloading precompiled Windows executable
5351

5452
A Windows standalone executable (.exe) of nrfutil is available for download on the [Releases](https://github.com/NordicSemiconductor/pc-nrfutil/releases) page.

azure-pipelines.yml

Lines changed: 92 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,111 @@
11
trigger:
2-
- test-azure
3-
- master
4-
- release/*
2+
- test-azure
3+
- master
4+
- release/*
55

66
jobs:
77
# Linux
88
- job: Linux
9+
strategy:
10+
matrix:
11+
py36:
12+
python_version: "3.6"
13+
py37:
14+
python_version: "3.7"
15+
py38:
16+
python_version: "3.8"
917
pool:
10-
vmImage: 'ubuntu-16.04'
18+
vmImage: "ubuntu-16.04"
1119
steps:
12-
- task: UsePythonVersion@0
13-
inputs:
14-
versionSpec: '3.7'
15-
- bash: |
16-
pip install setuptools
17-
pip install -r requirements-frozen.txt
18-
python setup.py sdist
19-
displayName: 'Build tar.gz with python 3.7'
20-
- bash: |
21-
pip install pyinstaller
22-
pyinstaller nrfutil.spec
23-
displayName: 'Build executable with python 3.7'
20+
- task: UsePythonVersion@0
21+
inputs:
22+
versionSpec: "$(python_version)"
23+
- bash: |
24+
pip install setuptools
25+
pip install -r requirements-frozen.txt
26+
python setup.py sdist
27+
displayName: "Build tar.gz with python $(python_version)"
28+
- bash: |
29+
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz
30+
pyinstaller nrfutil.spec
31+
displayName: "Build executable with python $(python_version)"
2432
2533
# macOS
2634
- job: macOS
35+
strategy:
36+
matrix:
37+
py36:
38+
python_version: "3.6"
39+
py37:
40+
python_version: "3.7"
41+
py38:
42+
python_version: "3.8"
2743
pool:
28-
vmImage: 'macos-10.13'
44+
vmImage: "macos-10.13"
2945
steps:
30-
- task: UsePythonVersion@0
31-
inputs:
32-
versionSpec: '3.7'
33-
- bash: |
34-
pip install setuptools
35-
pip install -r requirements-frozen.txt
36-
python setup.py sdist
37-
displayName: 'Build tar.gz with python 3.7'
38-
- bash: |
39-
pip install pyinstaller
40-
pyinstaller nrfutil.spec
41-
displayName: 'Build executable with python 3.7'
46+
- task: UsePythonVersion@0
47+
inputs:
48+
versionSpec: "$(python_version)"
49+
- bash: |
50+
pip install setuptools
51+
pip install -r requirements-frozen.txt
52+
python setup.py sdist
53+
displayName: "Build tar.gz with python $(python_version)"
54+
- bash: |
55+
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz
56+
pyinstaller nrfutil.spec
57+
displayName: "Build executable with python $(python_version)"
4258
4359
# Windows
4460
- job: Windows
4561
strategy:
4662
matrix:
47-
win32:
48-
python_arch: 'x86'
49-
win64:
50-
python_arch: 'x64'
63+
py36_win32:
64+
python_version: "3.6"
65+
python_arch: "x86"
66+
py36_win64:
67+
python_version: "3.6"
68+
python_arch: "x64"
69+
py37_win32:
70+
python_version: "3.7"
71+
python_arch: "x86"
72+
py37_win64:
73+
python_version: "3.7"
74+
python_arch: "x64"
75+
py38_win32:
76+
python_version: "3.8"
77+
python_arch: "x86"
78+
py38_win64:
79+
python_version: "3.8"
80+
python_arch: "x64"
5181
pool:
52-
vmImage: 'vs2017-win2016'
82+
vmImage: "vs2017-win2016"
5383
steps:
54-
- task: UsePythonVersion@0
55-
inputs:
56-
versionSpec: '3.7'
57-
architecture: '$(python_arch)'
58-
- bash: |
59-
pip install -r requirements-frozen.txt
60-
python setup.py sdist
61-
displayName: 'Build tar.gz with python 3.7'
62-
- bash: |
63-
pip install pyinstaller
64-
pyinstaller nrfutil.spec
65-
displayName: 'Build exe with python 3.7'
66-
- bash: |
67-
cp -R dist/*.tar.gz "$(Build.ArtifactStagingDirectory)"
68-
cp -R dist/*.exe "$(Build.ArtifactStagingDirectory)"
69-
condition: eq(variables['python_arch'], 'x64')
70-
displayName: 'Copy artifacts'
71-
- task: GitHubRelease@0
72-
inputs:
73-
gitHubConnection: 'waylandCI'
74-
repositoryName: 'NordicSemiconductor/pc-nrfutil'
75-
action: 'edit'
76-
tagSource: 'Git tag'
77-
tag: '$(Build.SourceBranchName)'
78-
assetUploadMode: 'replace'
79-
isDraft: 'true'
80-
addChangeLog: 'false'
81-
condition: ne(variables['Build.Reason'], 'PullRequest')
84+
- task: UsePythonVersion@0
85+
inputs:
86+
versionSpec: "$(python_version)"
87+
architecture: "$(python_arch)"
88+
- bash: |
89+
pip install -r requirements-frozen.txt
90+
python setup.py sdist
91+
displayName: "Build tar.gz with python $(python_version)"
92+
- bash: |
93+
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz
94+
pyinstaller nrfutil.spec
95+
displayName: "Build exe with python $(python_version)"
96+
- bash: |
97+
cp -R dist/*.tar.gz "$(Build.ArtifactStagingDirectory)"
98+
cp -R dist/*.exe "$(Build.ArtifactStagingDirectory)"
99+
condition: and(eq(variables['python_arch'], 'x64'), eq(variables['python_version'], '3.7'))
100+
displayName: "Copy artifacts"
101+
- task: GitHubRelease@0
102+
inputs:
103+
gitHubConnection: "waylandCI"
104+
repositoryName: "NordicSemiconductor/pc-nrfutil"
105+
action: "edit"
106+
tagSource: "Git tag"
107+
tag: "$(Build.SourceBranchName)"
108+
assetUploadMode: "replace"
109+
isDraft: "true"
110+
addChangeLog: "false"
111+
condition: ne(variables['Build.Reason'], 'PullRequest')

nordicsemi/__main__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@
5959
from nordicsemi.lister.device_lister import DeviceLister
6060
import spinel.util as util
6161

62-
# Python 2 compatibility provided by package future
63-
from builtins import input
64-
6562
logger = logging.getLogger(__name__)
6663

6764
def ble_driver_init(conn_ic_id):
@@ -197,7 +194,7 @@ def convert(self, value, param, ctx):
197194
class OptionRequiredIf(click.Option):
198195

199196
def full_process_value(self, ctx, value):
200-
value = super(OptionRequiredIf, self).full_process_value(ctx, value)
197+
value = super().full_process_value(ctx, value)
201198
if ('serial_number' not in ctx.params or not ctx.params['serial_number']) and value is None:
202199
msg = 'Required if "-snr" / "--serial-number" is not defined.'
203200
raise click.MissingParameter(ctx=ctx, param=self, message=msg)

nordicsemi/bluetooth/hci/codec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
UART_HEADER_OCTET_COUNT = 4
3939

4040

41-
class ThreeWireUartPacket(object):
41+
class ThreeWireUartPacket:
4242
"""
4343
This class encapsulate a three wire uart packet according to Bluetooth specification
4444
version 4.0 [Vol 4] part D.

nordicsemi/dfu/bl_dfu_sett.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
logger = logging.getLogger(__name__)
5555

56-
class BLDFUSettingsStructV1(object):
56+
class BLDFUSettingsStructV1:
5757

5858
def __init__(self, settings_address):
5959
self.bytes_count = 92
@@ -72,7 +72,7 @@ def __init__(self, settings_address):
7272
self.last_addr = settings_address + 0x5C
7373

7474

75-
class BLDFUSettingsStructV2(object):
75+
class BLDFUSettingsStructV2:
7676

7777
def __init__(self, settings_address):
7878
self.bytes_count = 803 # Entire settings page
@@ -97,7 +97,7 @@ def __init__(self, settings_address):
9797
self.last_addr = settings_address + 0x322
9898

9999

100-
class BLDFUSettings(object):
100+
class BLDFUSettings:
101101
""" Class to abstract a bootloader and its settings """
102102

103103
flash_page_51_sz = 0x400

nordicsemi/dfu/dfu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
logger = logging.getLogger(__name__)
5050

5151

52-
class Dfu(object):
52+
class Dfu:
5353
""" Class to handle upload of a new hex image to the device. """
5454

5555
def __init__(self, zip_file_path, dfu_transport, connect_delay):

nordicsemi/dfu/dfu_transport_ant.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class ValidationException(NordicSemiException):
9090
logger = logging.getLogger(__name__)
9191

9292

93-
class AntParams(object):
93+
class AntParams:
9494
# 2466 MHz
9595
DEF_RF_FREQ = 66
9696
# 16 Hz
@@ -110,7 +110,7 @@ def __init__(self):
110110
self.network_key = self.DEF_NETWORK_KEY
111111

112112

113-
class DfuAdapter(object):
113+
class DfuAdapter:
114114
ANT_RSP_TIMEOUT = 100
115115
ANT_DFU_CHAN = 0
116116
ANT_NET_KEY_IDX = 0
@@ -326,7 +326,7 @@ def __init__(self,
326326
prn=DEFAULT_PRN,
327327
debug=DEFAULT_DO_DEBUG):
328328

329-
super(DfuTransportAnt, self).__init__()
329+
super().__init__()
330330
if ant_config is None:
331331
ant_config = AntParams()
332332
self.ant_config = ant_config
@@ -341,7 +341,7 @@ def __init__(self,
341341

342342

343343
def open(self):
344-
super(DfuTransportAnt, self).open()
344+
super().open()
345345
ant_dev = None
346346
try:
347347
ant_dev = antlib.ANTDevice(self.port, 57600,
@@ -368,7 +368,7 @@ def open(self):
368368
self.__get_mtu()
369369

370370
def close(self):
371-
super(DfuTransportAnt, self).close()
371+
super().close()
372372
self.dfu_adapter.close()
373373

374374
def send_init_packet(self, init_packet):

nordicsemi/dfu/dfu_transport_ble.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class DFUAdapter(BLEDriverObserver, BLEAdapterObserver):
8484
LOCAL_ATT_MTU = 247
8585

8686
def __init__(self, adapter, bonded=False, keyset=None):
87-
super(DFUAdapter, self).__init__()
87+
super().__init__()
8888

8989
self.evt_sync = EvtSync(['connected', 'disconnected', 'sec_params',
9090
'auth_status', 'conn_sec_update'])
@@ -410,14 +410,14 @@ def on_gattc_evt_exchange_mtu_rsp(self, ble_driver, conn_handle, *, status, att_
410410

411411
class DfuBLEDriver(BLEDriver):
412412
def __init__(self, serial_port, baud_rate=115200, auto_flash=False):
413-
super(DfuBLEDriver, self).__init__(serial_port, baud_rate)
413+
super().__init__(serial_port, baud_rate)
414414

415415
@NordicSemiErrorCheck
416416
@wrapt.synchronized(BLEDriver.api_lock)
417417
def ble_gap_sec_params_reply(self, conn_handle, sec_status, sec_params, own_keys, peer_keys):
418418
assert isinstance(sec_status, BLEGapSecStatus), 'Invalid argument type'
419-
assert isinstance(sec_params, (BLEGapSecParams, NoneType)), 'Invalid argument type'
420-
assert isinstance(peer_keys, NoneType), 'NOT IMPLEMENTED'
419+
assert sec_params is None or isinstance(sec_params, BLEGapSecParams), 'Invalid argument type'
420+
assert peer_keys is None, 'NOT IMPLEMENTED'
421421

422422
return driver.sd_ble_gap_sec_params_reply(self.rpc_adapter,
423423
conn_handle,
@@ -438,7 +438,7 @@ def __init__(self,
438438
target_device_addr=None,
439439
baud_rate=1000000,
440440
prn=0):
441-
super(DfuTransportBle, self).__init__()
441+
super().__init__()
442442
DFUAdapter.LOCAL_ATT_MTU = att_mtu
443443
self.baud_rate = baud_rate
444444
self.serial_port = serial_port
@@ -455,7 +455,7 @@ def open(self):
455455
if self.dfu_adapter:
456456
raise IllegalStateException('DFU Adapter is already open')
457457

458-
super(DfuTransportBle, self).open()
458+
super().open()
459459
driver = DfuBLEDriver(serial_port = self.serial_port,
460460
baud_rate = self.baud_rate)
461461
adapter = BLEAdapter(driver)
@@ -474,7 +474,7 @@ def close(self):
474474

475475
if not self.dfu_adapter:
476476
raise IllegalStateException('DFU Adapter is already closed')
477-
super(DfuTransportBle, self).close()
477+
super().close()
478478
self.dfu_adapter.close()
479479
self.dfu_adapter = None
480480

nordicsemi/dfu/dfu_transport_serial.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ValidationException(NordicSemiException):
6161

6262
logger = logging.getLogger(__name__)
6363

64-
class Slip(object):
64+
class Slip:
6565
SLIP_BYTE_END = 0o300
6666
SLIP_BYTE_ESC = 0o333
6767
SLIP_BYTE_ESC_END = 0o334
@@ -112,7 +112,7 @@ def decode_add_byte(c, decoded_data, current_state):
112112

113113
return (finished, current_state, decoded_data)
114114

115-
class DFUAdapter(object):
115+
class DFUAdapter:
116116
def __init__(self, serial_port):
117117
self.serial_port = serial_port
118118

@@ -175,7 +175,7 @@ def __init__(self,
175175
prn=DEFAULT_PRN,
176176
do_ping=DEFAULT_DO_PING):
177177

178-
super(DfuTransportSerial, self).__init__()
178+
super().__init__()
179179
self.com_port = com_port
180180
self.baud_rate = baud_rate
181181
self.flow_control = 1 if flow_control else 0
@@ -192,7 +192,7 @@ def __init__(self,
192192

193193

194194
def open(self):
195-
super(DfuTransportSerial, self).open()
195+
super().open()
196196
try:
197197
self.__ensure_bootloader()
198198
self.serial_port = Serial(port=self.com_port,
@@ -217,7 +217,7 @@ def open(self):
217217
self.__get_mtu()
218218

219219
def close(self):
220-
super(DfuTransportSerial, self).close()
220+
super().close()
221221
self.serial_port.close()
222222

223223
def send_init_packet(self, init_packet):

nordicsemi/dfu/dfu_trigger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565
logger = logging.getLogger(__name__)
6666

67-
is_32_bit = ctypes.sizeof(ctypes.c_voidp) == 4
67+
is_32_bit = ctypes.sizeof(ctypes.c_void_p) == 4
6868
abs_file_dir = os.path.dirname(os.path.abspath(__file__))
6969
rel_import_dir = ""
7070

0 commit comments

Comments
 (0)