Ver código fonte

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

Chris Pepper 5 anos atrás
pai
commit
66f7065248
Nenhuma conta vinculada ao e-mail do autor do commit
1 arquivos alterados com 12 adições e 11 exclusões
  1. 12
    11
      Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py

+ 12
- 11
Marlin/src/HAL/HAL_LPC1768/upload_extra_script.py Ver arquivo

@@ -3,6 +3,7 @@
3 3
 #  if target_filename is found then that drive is used
4 4
 #  else if target_drive is found then that drive is used
5 5
 #
6
+from __future__ import print_function
6 7
 
7 8
 target_filename = "FIRMWARE.CUR"
8 9
 target_drive = "REARM"
@@ -12,11 +13,11 @@ import platform
12 13
 current_OS = platform.system()
13 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 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 22
 try:
22 23
     if current_OS == 'Windows':
@@ -63,9 +64,9 @@ try:
63 64
             env.Replace(
64 65
                 UPLOAD_PORT=upload_disk
65 66
             )
66
-            print 'upload disk: ', upload_disk
67
+            print('upload disk: ', upload_disk)
67 68
         else:
68
-            detect_error('Autodetect Error')
69
+            print_error('Autodetect Error')
69 70
 
70 71
     elif current_OS == 'Linux':
71 72
         #
@@ -100,9 +101,9 @@ try:
100 101
                 UPLOAD_FLAGS="-P$UPLOAD_PORT",
101 102
                 UPLOAD_PORT=upload_disk
102 103
             )
103
-            print 'upload disk: ', upload_disk
104
+            print('upload disk: ', upload_disk)
104 105
         else:
105
-            detect_error('Autodetect Error')
106
+            print_error('Autodetect Error')
106 107
 
107 108
     elif current_OS == 'Darwin':  # MAC
108 109
         #
@@ -133,9 +134,9 @@ try:
133 134
             env.Replace(
134 135
                 UPLOAD_PORT=upload_disk
135 136
             )
136
-            print '\nupload disk: ', upload_disk, '\n'
137
+            print('\nupload disk: ', upload_disk, '\n')
137 138
         else:
138
-            detect_error('Autodetect Error')
139
+            print_error('Autodetect Error')
139 140
 
140 141
 except Exception as e:
141
-    detect_error(str(e))
142
+    print_error(str(e))

Carregando…
Cancelar
Salvar