Browse Source

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

Chris Pepper 5 years ago
parent
commit
66f7065248
No account linked to committer's email address
1 changed files with 12 additions and 11 deletions
  1. 12
    11
      Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py

+ 12
- 11
Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py View File

3
 #  if target_filename is found then that drive is used
3
 #  if target_filename is found then that drive is used
4
 #  else if target_drive is found then that drive is used
4
 #  else if target_drive is found then that drive is used
5
 #
5
 #
6
+from __future__ import print_function
6
 
7
 
7
 target_filename = "FIRMWARE.CUR"
8
 target_filename = "FIRMWARE.CUR"
8
 target_drive = "REARM"
9
 target_drive = "REARM"
12
 current_OS = platform.system()
13
 current_OS = platform.system()
13
 Import("env")
14
 Import("env")
14
 
15
 
15
-def detect_error(e):
16
-    print '\nUnable to find destination disk (' + e + ')\n' \
16
+def print_error(e):
17
+    print('\nUnable to find destination disk (' + e + ')\n' \
17
           'Please select it in platformio.ini using the upload_port keyword ' \
18
           'Please select it in platformio.ini using the upload_port keyword ' \
18
-          '(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html)\n' \
19
-          'or copy the firmware (.pioenvs/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n'
19
+          '(https://docs.platformio.org/en/latest/projectconf/section_env_upload.html) ' \
20
+          'or copy the firmware (.pioenvs/' + env.get('PIOENV') + '/firmware.bin) manually to the appropriate disk\n')
20
 
21
 
21
 try:
22
 try:
22
     if current_OS == 'Windows':
23
     if current_OS == 'Windows':
63
             env.Replace(
64
             env.Replace(
64
                 UPLOAD_PORT=upload_disk
65
                 UPLOAD_PORT=upload_disk
65
             )
66
             )
66
-            print 'upload disk: ', upload_disk
67
+            print('upload disk: ', upload_disk)
67
         else:
68
         else:
68
-            detect_error('Autodetect Error')
69
+            print_error('Autodetect Error')
69
 
70
 
70
     elif current_OS == 'Linux':
71
     elif current_OS == 'Linux':
71
         #
72
         #
100
                 UPLOAD_FLAGS="-P$UPLOAD_PORT",
101
                 UPLOAD_FLAGS="-P$UPLOAD_PORT",
101
                 UPLOAD_PORT=upload_disk
102
                 UPLOAD_PORT=upload_disk
102
             )
103
             )
103
-            print 'upload disk: ', upload_disk
104
+            print('upload disk: ', upload_disk)
104
         else:
105
         else:
105
-            detect_error('Autodetect Error')
106
+            print_error('Autodetect Error')
106
 
107
 
107
     elif current_OS == 'Darwin':  # MAC
108
     elif current_OS == 'Darwin':  # MAC
108
         #
109
         #
133
             env.Replace(
134
             env.Replace(
134
                 UPLOAD_PORT=upload_disk
135
                 UPLOAD_PORT=upload_disk
135
             )
136
             )
136
-            print '\nupload disk: ', upload_disk, '\n'
137
+            print('\nupload disk: ', upload_disk, '\n')
137
         else:
138
         else:
138
-            detect_error('Autodetect Error')
139
+            print_error('Autodetect Error')
139
 
140
 
140
 except Exception as e:
141
 except Exception as e:
141
-    detect_error(str(e))
142
+    print_error(str(e))

Loading…
Cancel
Save