Builder: append target suffix to the filename instead of replacing

This commit is contained in:
Ivan Kravets
2018-02-20 01:10:27 +02:00
parent aa0b6c2071
commit cdee242333

View File

@ -19,6 +19,7 @@ from os import environ
from os.path import expanduser, join
from time import time
from SCons import Builder, Util
from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, DEFAULT_TARGETS,
Action, AllowSubstExceptions, AlwaysBuild,
DefaultEnvironment, Variables)
@ -27,6 +28,19 @@ from platformio import util
AllowSubstExceptions(NameError)
def scons_patched_match_splitext(path, suffixes=None):
"""
Patch SCons version, append $OBJSUFFIX to the end of each target
"""
result = Util.splitext(path)
if result[1] in (suffixes or []):
return (path, result[1])
return result
Builder.match_splitext = scons_patched_match_splitext
# allow common variables from INI file
commonvars = Variables(None)
commonvars.AddVariables(