1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-27 05:48:43 +00:00

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

This commit is contained in:
Chris Pepper 2019-05-04 20:52:28 +01:00 committed by GitHub
parent 2f32a6612d
commit 66f7065248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))