From 88d9adf2df28f5f1e4d1182f4db48ddbcbc88062 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 15 May 2017 15:52:15 -0700 Subject: py2/3 don't call id in ipkg tool generate method if it's not available. This was causing test/import.py to fail --- src/engine/SCons/Tool/ipkg.py | 24 +++++++++++++++--------- test/import.py | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/engine/SCons/Tool/ipkg.py b/src/engine/SCons/Tool/ipkg.py index 452cbb9..df77eea 100644 --- a/src/engine/SCons/Tool/ipkg.py +++ b/src/engine/SCons/Tool/ipkg.py @@ -44,20 +44,26 @@ def generate(env): try: bld = env['BUILDERS']['Ipkg'] except KeyError: - bld = SCons.Builder.Builder( action = '$IPKGCOM', - suffix = '$IPKGSUFFIX', - source_scanner = None, - target_scanner = None) + bld = SCons.Builder.Builder(action='$IPKGCOM', + suffix='$IPKGSUFFIX', + source_scanner=None, + target_scanner=None) env['BUILDERS']['Ipkg'] = bld - env['IPKG'] = 'ipkg-build' - env['IPKGCOM'] = '$IPKG $IPKGFLAGS ${SOURCE}' - env['IPKGUSER'] = os.popen('id -un').read().strip() - env['IPKGGROUP'] = os.popen('id -gn').read().strip() - env['IPKGFLAGS'] = SCons.Util.CLVar('-o $IPKGUSER -g $IPKGGROUP') + + env['IPKG'] = 'ipkg-build' + env['IPKGCOM'] = '$IPKG $IPKGFLAGS ${SOURCE}' + + if env.WhereIs('id'): + env['IPKGUSER'] = os.popen('id -un').read().strip() + env['IPKGGROUP'] = os.popen('id -gn').read().strip() + env['IPKGFLAGS'] = SCons.Util.CLVar('-o $IPKGUSER -g $IPKGGROUP') env['IPKGSUFFIX'] = '.ipk' def exists(env): + """ + Can we find the tool + """ return env.Detect('ipkg-build') # Local Variables: diff --git a/test/import.py b/test/import.py index c23657a..b6e5a8d 100644 --- a/test/import.py +++ b/test/import.py @@ -64,7 +64,7 @@ platforms = [ for platform in platforms: test.write('SConstruct', """ print("Platform %(platform)s") -env = Environment(platform = '%(platform)s') +env = Environment(platform = '%(platform)s', tools=[]) import SCons.Platform.%(platform)s x = SCons.Platform.%(platform)s.generate """ % locals()) -- cgit v0.12