Skip to content
Snippets Groups Projects
Unverified Commit 66f70652 authored by Chris Pepper's avatar Chris Pepper Committed by GitHub
Browse files

[LPC176x] Update extra script to support Python3 (#13908)

parent 2f32a661
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
# if target_filename is found then that drive is used
# else if target_drive is found then that drive is used
#
from __future__ import print_function
target_filename = "FIRMWARE.CUR"
target_drive = "REARM"
......@@ -12,11 +13,11 @@ import platform
current_OS = platform.system()
Import("env")
def detect_error(e):
print '\nUnable to find destination disk (' + e + ')\n' \
def print_error(e):
print('\nUnable to find destination disk (' + e + ')\n' \
'Please select it in platformio.ini using the upload_port keyword ' \
'(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html)\n' \
'or copy the firmware (.pioenvs/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n'
'(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html) ' \
'or copy the firmware (.pioenvs/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n')
try:
if current_OS == 'Windows':
......@@ -63,9 +64,9 @@ try:
env.Replace(
UPLOAD_PORT=upload_disk
)
print 'upload disk: ', upload_disk
print('upload disk: ', upload_disk)
else:
detect_error('Autodetect Error')
print_error('Autodetect Error')
elif current_OS == 'Linux':
#
......@@ -100,9 +101,9 @@ try:
UPLOAD_FLAGS="-P$UPLOAD_PORT",
UPLOAD_PORT=upload_disk
)
print 'upload disk: ', upload_disk
print('upload disk: ', upload_disk)
else:
detect_error('Autodetect Error')
print_error('Autodetect Error')
elif current_OS == 'Darwin': # MAC
#
......@@ -133,9 +134,9 @@ try:
env.Replace(
UPLOAD_PORT=upload_disk
)
print '\nupload disk: ', upload_disk, '\n'
print('\nupload disk: ', upload_disk, '\n')
else:
detect_error('Autodetect Error')
print_error('Autodetect Error')
except Exception as e:
detect_error(str(e))
print_error(str(e))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment