parameters: (strSubst, env, key)
docstring: Perform single (non-recursive) substitution of a single
      construction variable keyword.
  
      This is used when setting a variable when copying or overriding values
      in an Environment.  We want to capture (expand) the old value before
      we override it, so people can do things like:
  
          env2 = env.Clone(CCFLAGS = '$CCFLAGS -g')
  
      We do this with some straightforward, brute-force code here...
docstring_summary: Perform single (non-recursive) substitution of a single
      construction variable keyword.
docstring_tokens: Perform single ( non - recursive ) substitution of a single construction variable keyword .
function: def scons_subst_once(strSubst, env, key):
      """Perform single (non-recursive) substitution of a single
      construction variable keyword.
  
      This is used when setting a variable when copying or overriding values
      in an Environment.  We want to capture (expand) the old value before
      we override it, so people can do things like:
  
          env2 = env.Clone(CCFLAGS = '$CCFLAGS -g')
  
      We do this with some straightforward, brute-force code here...
      """
      if isinstance(strSubst, str) and strSubst.find('$') < 0:
          return strSubst
  
      matchlist = ['$' + key, '${' + key + '}']
      val = env.get(key, '')
      def sub_match(match, val=val, matchlist=matchlist):
          a = match.group(1)
          if a in matchlist:
              a = val
          if is_Sequence(a):
              return ' '.join(map(str, a))
          else:
              return str(a)
  
      if is_Sequence(strSubst):
          result = []
          for arg in strSubst:
              if is_String(arg):
                  if arg in matchlist:
                      arg = val
                      if is_Sequence(arg):
                          result.extend(arg)
                      else:
                          result.append(arg)
                  else:
                      result.append(_dollar_exps.sub(sub_match, arg))
              else:
                  result.append(arg)
          return result
      elif is_String(strSubst):
          return _dollar_exps.sub(sub_match, strSubst)
      else:
          return strSubst
function_tokens: def scons_subst_once ( strSubst , env , key ) : if isinstance ( strSubst , str ) and strSubst . find ( '$' ) < 0 : return strSubst matchlist = [ '$' + key , '${' + key + '}' ] val = env . get ( key , '' ) def sub_match ( match , val = val , matchlist = matchlist ) : a = match . group ( 1 ) if a in matchlist : a = val if is_Sequence ( a ) : return ' ' . join ( map ( str , a ) ) else : return str ( a ) if is_Sequence ( strSubst ) : result = [ ] for arg in strSubst : if is_String ( arg ) : if arg in matchlist : arg = val if is_Sequence ( arg ) : result . extend ( arg ) else : result . append ( arg ) else : result . append ( _dollar_exps . sub ( sub_match , arg ) ) else : result . append ( arg ) return result elif is_String ( strSubst ) : return _dollar_exps . sub ( sub_match , strSubst ) else : return strSubst