Skip to content

Commit

Permalink
[scons] Work around missing env.has_key
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Aug 7, 2021
1 parent c7eadef commit e84b2d0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/build_script_generator/scons/site_tools/size.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@

from SCons.Script import *

def show_size(env, source, alias='__size'):
if env.has_key('CONFIG_DEVICE_MEMORY'):
def show_size(env, source, alias="__size"):
if "CONFIG_DEVICE_MEMORY" in env:
def size_action(target, source, env):
from modm_tools import size
print(size.format(source[0].abspath, env['CONFIG_DEVICE_MEMORY']))
print(size.format(source[0].abspath, env["CONFIG_DEVICE_MEMORY"]))
return 0
action = Action(size_action, cmdstr="$SIZECOMSTR")
elif env.has_key('CONFIG_DEVICE_NAME'):
elif "CONFIG_DEVICE_NAME" in env:
# AVR devices use avr-objdump -Pmem-usage via ELF file
action = Action("$OBJDUMP -Pmem-usage {}".format(source[0].path),
cmdstr="$SIZECOMSTR")
Expand All @@ -45,7 +45,7 @@ def size_action(target, source, env):
return env.AlwaysBuild(env.Alias(alias, source, action))

def generate(env, **kw):
env.AddMethod(show_size, 'Size')
env.AddMethod(show_size, "Size")

def exists(env):
return True

0 comments on commit e84b2d0

Please sign in to comment.