X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senfscons%2Fsenfutil.py;h=d1a2808dedf596e999b35206b2c28017b213094f;hb=f214d8c456b57c851066b6dd437049938f8a91ee;hp=69f18e09159ad87f37e4d98ca3c8a7488909f6d8;hpb=c608344663f72bb564e5b3b9f8c01bb73ee37a3a;p=senf.git diff --git a/senfscons/senfutil.py b/senfscons/senfutil.py index 69f18e0..d1a2808 100644 --- a/senfscons/senfutil.py +++ b/senfscons/senfutil.py @@ -1,6 +1,23 @@ import os.path from SCons.Script import * +def setLogOption(env): + # Parse LOGLEVELS parameter + def parseLogOption(value): + stream, area, level = ( x.strip() for x in value.strip().split('|') ) + stream = ''.join('(%s)' % x for x in stream.split('::') ) + if area : area = ''.join( '(%s)' % x for x in area.split('::') ) + else : area = '(_)' + return '(( %s,%s,%s ))' % (stream,area,level) + + def expandLogOption(target, source, env, for_signature): + return ' '.join( parseLogOption(x) for x in env.subst('$LOGLEVELS').split() ) + + if env.subst('$LOGLEVELS'): + env.Append( expandLogOption=expandLogOption ) + env.Append( CPPDEFINES = { 'SENF_LOG_CONF': '$expandLogOption' } ) + + ########################################################################### # This looks much more complicated than it is: We do three things here: # a) switch between final or debug options @@ -25,17 +42,6 @@ def SetupForSENF(env): LINKFLAGS_debug = [ '-g', '-rdynamic' ], ) - # Parse LOGLEVELS parameter - def parseLogOption(value): - stream, area, level = ( x.strip() for x in value.strip().split('|') ) - stream = ''.join('(%s)' % x for x in stream.split('::') ) - if area : area = ''.join( '(%s)' % x for x in area.split('::') ) - else : area = '(_)' - return '(( %s,%s,%s ))' % (stream,area,level) - - def expandLogOption(target, source, env, for_signature): - return ' '.join( parseLogOption(x) for x in env.subst('$LOGLEVELS').split() ) - # Add command-line options: 'LOGLEVELS' and 'final' opts = Options() opts.Add( 'LOGLEVELS', 'Special log levels. Syntax: |[]| ...', @@ -45,12 +51,10 @@ def SetupForSENF(env): opts.Add( BoolOption('profile', 'Add profile information', False) ) opts.Update(env) - if env.subst('$LOGLEVELS'): - env.Append( expandLogOption=expandLogOption ) - env.Append( CPPDEFINES = { 'SENF_LOG_CONF': '$expandLogOption' } ) - env.Help(opts.GenerateHelpText(env)) + setLogOption(env) + # If we have a symbolic link (or directory) 'senf', we use it as our # senf repository if os.path.exists('senf'):