More python updates

Followup to #13931
This commit is contained in:
Scott Lahteine 2019-05-07 20:54:01 -05:00
parent af725c81e3
commit 059269d732
4 changed files with 26 additions and 22 deletions

View file

@ -1,3 +1,4 @@
#!/usr/bin/env python
#######################################
#
# Marlin 3D Printer Firmware
@ -68,6 +69,9 @@
#
#######################################
from __future__ import print_function
from __future__ import division
import sys
import os
@ -76,26 +80,26 @@ pwd = pwd.replace('\\', '/')
if 0 <= pwd.find('buildroot/share/atom'):
pwd = pwd[ : pwd.find('buildroot/share/atom')]
os.chdir(pwd)
print 'pwd: ', pwd
print('pwd: ', pwd)
num_args = len(sys.argv)
if num_args > 1:
build_type = str(sys.argv[1])
else:
print 'Please specify build type'
print('Please specify build type')
exit()
print'build_type: ', build_type
print('build_type: ', build_type)
print '\nWorking\n'
print('\nWorking\n')
python_ver = sys.version_info[0] # major version - 2 or 3
if python_ver == 2:
print "python version " + str(sys.version_info[0]) + "." + str(sys.version_info[1]) + "." + str(sys.version_info[2])
print("python version " + str(sys.version_info[0]) + "." + str(sys.version_info[1]) + "." + str(sys.version_info[2]))
else:
print "python version " + str(sys.version_info[0])
print "This script only runs under python 2"
print("python version " + str(sys.version_info[0]))
print("This script only runs under python 2")
exit()
import platform
@ -544,13 +548,13 @@ def get_CPU_name(environment):
# returns: environment
def get_env(board_name, ver_Marlin):
def no_environment():
print 'ERROR - no environment for this board'
print board_name
print('ERROR - no environment for this board')
print(board_name)
raise SystemExit(0) # no environment so quit
def invalid_board():
print 'ERROR - invalid board'
print board_name
print('ERROR - invalid board')
print(board_name)
raise SystemExit(0) # quit if unable to find board
@ -601,9 +605,9 @@ def get_env(board_name, ver_Marlin):
invalid_board()
if build_type == 'traceback' and not(target_env == 'LPC1768_debug_and_upload' or target_env == 'DUE_debug') and Marlin_ver == 2:
print "ERROR - this board isn't setup for traceback"
print 'board_name: ', board_name
print 'target_env: ', target_env
print("ERROR - this board isn't setup for traceback")
print('board_name: ', board_name)
print('target_env: ', target_env)
raise SystemExit(0)
return target_env
@ -825,12 +829,12 @@ def run_PIO(dummy):
global build_type
global target_env
global board_name
print 'build_type: ', build_type
print('build_type: ', build_type)
import subprocess
import sys
print 'starting platformio'
print('starting platformio')
if build_type == 'build':
# platformio run -e target_env
@ -881,7 +885,7 @@ def run_PIO(dummy):
else:
print 'ERROR - unknown build type: ', build_type
print('ERROR - unknown build type: ', build_type)
raise SystemExit(0) # kill everything
# stream output from subprocess and split it into lines
@ -1099,7 +1103,7 @@ class output_window(Text):
self.start_thread()
def rebuild(self, event):
print "event happened"
print("event happened")
self._rebuild()

View file

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

View file

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