1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 07:17:59 +00:00

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

View File

@ -84,8 +84,8 @@ else:
if com_CDC == 'COM_PORT_NOT_FOUND': if com_CDC == 'COM_PORT_NOT_FOUND':
print(com_CDC, '\n') print(com_CDC, '\n')
else: else:
print('FOUND: ' ,com_CDC) print('FOUND: ', com_CDC)
print('DESCRIPTION: ', description_CDC , '\n') print('DESCRIPTION: ', description_CDC, '\n')
if current_OS == 'Windows': if current_OS == 'Windows':

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
"""Thermistor Value Lookup Table Generator """Thermistor Value Lookup Table Generator
Generates lookup to temperature values for use in a microcontroller in C format based on: 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 # 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 # It will analyse the first 2 Layer and return the maximum size for this part