Browse Source

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

pull/1/head
Chris Pepper 6 years ago
committed by GitHub
parent
commit
66f7065248
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py

23
Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py

@ -3,6 +3,7 @@
# if target_filename is found then that drive is used # if target_filename is found then that drive is used
# else if target_drive 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_filename = "FIRMWARE.CUR"
target_drive = "REARM" target_drive = "REARM"
@ -12,11 +13,11 @@ import platform
current_OS = platform.system() current_OS = platform.system()
Import("env") Import("env")
def detect_error(e): def print_error(e):
print '\nUnable to find destination disk (' + e + ')\n' \ print('\nUnable to find destination disk (' + e + ')\n' \
'Please select it in platformio.ini using the upload_port keyword ' \ 'Please select it in platformio.ini using the upload_port keyword ' \
'(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html)\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' 'or copy the firmware (.pioenvs/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n')
try: try:
if current_OS == 'Windows': if current_OS == 'Windows':
@ -63,9 +64,9 @@ try:
env.Replace( env.Replace(
UPLOAD_PORT=upload_disk UPLOAD_PORT=upload_disk
) )
print 'upload disk: ', upload_disk print('upload disk: ', upload_disk)
else: else:
detect_error('Autodetect Error') print_error('Autodetect Error')
elif current_OS == 'Linux': elif current_OS == 'Linux':
# #
@ -100,9 +101,9 @@ try:
UPLOAD_FLAGS="-P$UPLOAD_PORT", UPLOAD_FLAGS="-P$UPLOAD_PORT",
UPLOAD_PORT=upload_disk UPLOAD_PORT=upload_disk
) )
print 'upload disk: ', upload_disk print('upload disk: ', upload_disk)
else: else:
detect_error('Autodetect Error') print_error('Autodetect Error')
elif current_OS == 'Darwin': # MAC elif current_OS == 'Darwin': # MAC
# #
@ -133,9 +134,9 @@ try:
env.Replace( env.Replace(
UPLOAD_PORT=upload_disk UPLOAD_PORT=upload_disk
) )
print '\nupload disk: ', upload_disk, '\n' print('\nupload disk: ', upload_disk, '\n')
else: else:
detect_error('Autodetect Error') print_error('Autodetect Error')
except Exception as e: except Exception as e:
detect_error(str(e)) print_error(str(e))

Loading…
Cancel
Save