Fix Python scripts unhandled quotes (#14926)

This commit is contained in:
Tanguy Pruvot 2019-08-13 02:50:34 +02:00 committed by Scott Lahteine
parent c6be989fca
commit 03df3f4a88
7 changed files with 11 additions and 10 deletions

View file

@ -7,7 +7,7 @@ for define in env['CPPDEFINES']:
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000")) env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/alfawise_Ux0.ld") env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/alfawise_Ux0.ld")
# Encrypt ${PROGNAME}.bin and save it as 'project.bin' # Rename ${PROGNAME}.bin and save it as 'project.bin' (No encryption on the Longer3D)
def encrypt(source, target, env): def encrypt(source, target, env):
import os import os
@ -23,4 +23,5 @@ def encrypt(source, target, env):
finally: finally:
firmware.close() firmware.close()
marlin_alfa.close() marlin_alfa.close()
env.AddPostAction('"$BUILD_DIR/${PROGNAME}.bin"', encrypt);
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);

View file

@ -12,7 +12,7 @@ env.AddPostAction(
join("$BUILD_DIR","${PROGNAME}.elf"), join("$BUILD_DIR","${PROGNAME}.elf"),
env.VerboseAction(" ".join([ env.VerboseAction(" ".join([
"$OBJCOPY", "-O ihex", "$TARGET", # TARGET=.pio/build/fysetc_STM32F1/firmware.elf "$OBJCOPY", "-O ihex", "$TARGET", # TARGET=.pio/build/fysetc_STM32F1/firmware.elf
"'" + join("$BUILD_DIR","${PROGNAME}.hex") + "'", # Note: $BUILD_DIR is a full path "\"" + join("$BUILD_DIR","${PROGNAME}.hex") + "\"", # Note: $BUILD_DIR is a full path
]), "Building $TARGET")) ]), "Building $TARGET"))
# please keep $SOURCE variable, it will be replaced with a path to firmware # please keep $SOURCE variable, it will be replaced with a path to firmware
@ -27,11 +27,11 @@ env.AddPostAction(
UPLOAD_TOOL="stm32flash" UPLOAD_TOOL="stm32flash"
platform = env.PioPlatform() platform = env.PioPlatform()
if platform.get_package_dir("tool-stm32duino") != None: if platform.get_package_dir("tool-stm32duino") != None:
UPLOAD_TOOL=expandvars("'" + join(platform.get_package_dir("tool-stm32duino"),"stm32flash","stm32flash") + "'") UPLOAD_TOOL=expandvars("\"" + join(platform.get_package_dir("tool-stm32duino"),"stm32flash","stm32flash") + "\"")
env.Replace( env.Replace(
UPLOADER=UPLOAD_TOOL, UPLOADER=UPLOAD_TOOL,
UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr $UPLOAD_PORT -R -w '" + join("$BUILD_DIR","${PROGNAME}.hex") + "'") UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr $UPLOAD_PORT -R -w \"" + join("$BUILD_DIR","${PROGNAME}.hex")+"\"")
) )
# Python callback # Python callback

View file

@ -39,5 +39,5 @@ def addboot(source,target,env):
os.rename(target[0].path, firmware_without_bootloader_dir) os.rename(target[0].path, firmware_without_bootloader_dir)
#os.rename(target[0].dir.path+'/firmware_with_bootloader.bin', target[0].dir.path+'/firmware.bin') #os.rename(target[0].dir.path+'/firmware_with_bootloader.bin', target[0].dir.path+'/firmware.bin')
env.AddPostAction('"$BUILD_DIR/${PROGNAME}.bin"', addboot); env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", addboot);

View file

@ -27,4 +27,4 @@ def encrypt(source, target, env):
finally: finally:
firmware.close() firmware.close()
robin.close() robin.close()
env.AddPostAction('"$BUILD_DIR/${PROGNAME}.bin"', encrypt); env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);

View file

@ -27,4 +27,4 @@ def encrypt(source, target, env):
finally: finally:
firmware.close() firmware.close()
robin.close() robin.close()
env.AddPostAction('"$BUILD_DIR/${PROGNAME}.bin"', encrypt); env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);

View file

@ -27,4 +27,4 @@ def encrypt(source, target, env):
finally: finally:
firmware.close() firmware.close()
robin.close() robin.close()
env.AddPostAction('"$BUILD_DIR/${PROGNAME}.bin"', encrypt); env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);

View file

@ -27,4 +27,4 @@ def encrypt(source, target, env):
finally: finally:
firmware.close() firmware.close()
robin.close() robin.close()
env.AddPostAction('"$BUILD_DIR/${PROGNAME}.bin"', encrypt); env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);