Bladeren bron

More python updates

Followup to #13931
Scott Lahteine 5 jaren geleden
bovenliggende
commit
059269d732

+ 22
- 18
buildroot/share/atom/auto_build.py Bestand weergeven

1
+#!/usr/bin/env python
1
 #######################################
2
 #######################################
2
 #
3
 #
3
 # Marlin 3D Printer Firmware
4
 # Marlin 3D Printer Firmware
68
 #
69
 #
69
 #######################################
70
 #######################################
70
 
71
 
72
+from __future__ import print_function
73
+from __future__ import division
74
+
71
 import sys
75
 import sys
72
 import os
76
 import os
73
 
77
 
76
 if 0 <= pwd.find('buildroot/share/atom'):
80
 if 0 <= pwd.find('buildroot/share/atom'):
77
   pwd = pwd[ : pwd.find('buildroot/share/atom')]
81
   pwd = pwd[ : pwd.find('buildroot/share/atom')]
78
   os.chdir(pwd)
82
   os.chdir(pwd)
79
-print 'pwd: ', pwd
83
+print('pwd: ', pwd)
80
 
84
 
81
 num_args = len(sys.argv)
85
 num_args = len(sys.argv)
82
 if num_args > 1:
86
 if num_args > 1:
83
   build_type = str(sys.argv[1])
87
   build_type = str(sys.argv[1])
84
 else:
88
 else:
85
-  print 'Please specify build type'
89
+  print('Please specify build type')
86
   exit()
90
   exit()
87
 
91
 
88
-print'build_type:  ', build_type
92
+print('build_type:  ', build_type)
89
 
93
 
90
-print '\nWorking\n'
94
+print('\nWorking\n')
91
 
95
 
92
 python_ver = sys.version_info[0] # major version - 2 or 3
96
 python_ver = sys.version_info[0] # major version - 2 or 3
93
 
97
 
94
 if python_ver == 2:
98
 if python_ver == 2:
95
-  print "python version " + str(sys.version_info[0]) + "." + str(sys.version_info[1]) + "." + str(sys.version_info[2])
99
+  print("python version " + str(sys.version_info[0]) + "." + str(sys.version_info[1]) + "." + str(sys.version_info[2]))
96
 else:
100
 else:
97
-  print "python version " + str(sys.version_info[0])
98
-  print "This script only runs under python 2"
101
+  print("python version " + str(sys.version_info[0]))
102
+  print("This script only runs under python 2")
99
   exit()
103
   exit()
100
 
104
 
101
 import platform
105
 import platform
544
 #  returns: environment
548
 #  returns: environment
545
 def get_env(board_name, ver_Marlin):
549
 def get_env(board_name, ver_Marlin):
546
       def no_environment():
550
       def no_environment():
547
-            print 'ERROR - no environment for this board'
548
-            print board_name
551
+            print('ERROR - no environment for this board')
552
+            print(board_name)
549
             raise SystemExit(0)                          # no environment so quit
553
             raise SystemExit(0)                          # no environment so quit
550
 
554
 
551
       def invalid_board():
555
       def invalid_board():
552
-            print 'ERROR - invalid board'
553
-            print board_name
556
+            print('ERROR - invalid board')
557
+            print(board_name)
554
             raise SystemExit(0)                          # quit if unable to find board
558
             raise SystemExit(0)                          # quit if unable to find board
555
 
559
 
556
 
560
 
601
               invalid_board()
605
               invalid_board()
602
 
606
 
603
       if build_type == 'traceback' and not(target_env == 'LPC1768_debug_and_upload' or target_env == 'DUE_debug')  and Marlin_ver == 2:
607
       if build_type == 'traceback' and not(target_env == 'LPC1768_debug_and_upload' or target_env == 'DUE_debug')  and Marlin_ver == 2:
604
-          print "ERROR - this board isn't setup for traceback"
605
-          print 'board_name: ', board_name
606
-          print 'target_env: ', target_env
608
+          print("ERROR - this board isn't setup for traceback")
609
+          print('board_name: ', board_name)
610
+          print('target_env: ', target_env)
607
           raise SystemExit(0)
611
           raise SystemExit(0)
608
 
612
 
609
       return target_env
613
       return target_env
825
     global build_type
829
     global build_type
826
     global target_env
830
     global target_env
827
     global board_name
831
     global board_name
828
-    print 'build_type:  ', build_type
832
+    print('build_type:  ', build_type)
829
 
833
 
830
     import subprocess
834
     import subprocess
831
     import sys
835
     import sys
832
 
836
 
833
-    print 'starting platformio'
837
+    print('starting platformio')
834
 
838
 
835
     if   build_type == 'build':
839
     if   build_type == 'build':
836
           # platformio run -e  target_env
840
           # platformio run -e  target_env
881
 
885
 
882
 
886
 
883
     else:
887
     else:
884
-          print 'ERROR - unknown build type:  ', build_type
888
+          print('ERROR - unknown build type:  ', build_type)
885
           raise SystemExit(0)     # kill everything
889
           raise SystemExit(0)     # kill everything
886
 
890
 
887
   # stream output from subprocess and split it into lines
891
   # stream output from subprocess and split it into lines
1099
         self.start_thread()
1103
         self.start_thread()
1100
 
1104
 
1101
     def rebuild(self, event):
1105
     def rebuild(self, event):
1102
-        print "event happened"
1106
+        print("event happened")
1103
         self._rebuild()
1107
         self._rebuild()
1104
 
1108
 
1105
 
1109
 

+ 2
- 2
buildroot/share/atom/create_custom_upload_command_CDC.py Bestand weergeven

84
       if com_CDC == 'COM_PORT_NOT_FOUND':
84
       if com_CDC == 'COM_PORT_NOT_FOUND':
85
           print(com_CDC, '\n')
85
           print(com_CDC, '\n')
86
       else:
86
       else:
87
-          print('FOUND: ' ,com_CDC)
88
-          print('DESCRIPTION: ',  description_CDC , '\n')
87
+          print('FOUND: ', com_CDC)
88
+          print('DESCRIPTION: ', description_CDC, '\n')
89
 
89
 
90
   if current_OS == 'Windows':
90
   if current_OS == 'Windows':
91
 
91
 

+ 1
- 1
buildroot/share/scripts/createTemperatureLookupMarlin.py Bestand weergeven

1
-#!/usr/bin/python
1
+#!/usr/bin/env python
2
 """Thermistor Value Lookup Table Generator
2
 """Thermistor Value Lookup Table Generator
3
 
3
 
4
 Generates lookup to temperature values for use in a microcontroller in C format based on:
4
 Generates lookup to temperature values for use in a microcontroller in C format based on:

+ 1
- 1
buildroot/share/scripts/g29_auto.py Bestand weergeven

1
-#!/usr/bin/python
1
+#!/usr/bin/env python
2
 
2
 
3
 # This file is for preprocessing gcode and the new G29 Autobedleveling from Marlin
3
 # This file is for preprocessing gcode and the new G29 Autobedleveling from Marlin
4
 # It will analyse the first 2 Layer and return the maximum size for this part
4
 # It will analyse the first 2 Layer and return the maximum size for this part

Laden…
Annuleren
Opslaan