Convert py scripts for py2 and py3 compatibility (#13931)

This commit is contained in:
Alexey Shvetsov
2019-05-08 04:45:01 +03:00
committed by Scott Lahteine
parent 11adcf1ce3
commit af725c81e3
4 changed files with 51 additions and 39 deletions

View File

@ -1,3 +1,4 @@
#!/usr/bin/env python
#
# Builds custom upload command
# 1) Run platformio as a subprocess to find a COM port
@ -9,6 +10,9 @@
# Will continue on if a COM port isn't found so that the compilation can be done.
#
from __future__ import print_function
from __future__ import division
import subprocess
import os
import sys
@ -45,7 +49,7 @@ else:
global description_CDC
print '\nLooking for Serial Port\n'
print('\nLooking for Serial Port\n')
# stream output from subprocess and split it into lines
pio_subprocess = subprocess.Popen(['platformio', 'device', 'list'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
@ -78,10 +82,10 @@ else:
com_CDC = com_CDC.replace('\r', '')
if com_CDC == 'COM_PORT_NOT_FOUND':
print com_CDC, '\n'
print(com_CDC, '\n')
else:
print 'FOUND: ' ,com_CDC
print 'DESCRIPTION: ', description_CDC , '\n'
print('FOUND: ' ,com_CDC)
print('DESCRIPTION: ', description_CDC , '\n')
if current_OS == 'Windows':
@ -114,7 +118,7 @@ else:
# upload_string = 'avrdude -p usb1286 -c avr109 -P ' + com_CDC + ' -U flash:w:' + source_path + ':i'
upload_string = avrdude_exe_path + ' -p usb1286 -c avr109 -P ' + com_CDC + ' -C ' + avrdude_conf_path + ' -U flash:w:' + source_path + ':i'
print 'upload_string: ', upload_string
print('upload_string: ', upload_string)