Browse Source

More python updates

Followup to #13931
Scott Lahteine 5 years ago
parent
commit
059269d732

+ 22
- 18
buildroot/share/atom/auto_build.py View File

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

+ 2
- 2
buildroot/share/atom/create_custom_upload_command_CDC.py View File

@@ -84,8 +84,8 @@ else:
84 84
       if com_CDC == 'COM_PORT_NOT_FOUND':
85 85
           print(com_CDC, '\n')
86 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 90
   if current_OS == 'Windows':
91 91
 

+ 1
- 1
buildroot/share/scripts/createTemperatureLookupMarlin.py View File

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

+ 1
- 1
buildroot/share/scripts/g29_auto.py View File

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

Loading…
Cancel
Save