parameters: (cplusplus)
return_statement: return subprocess.call(compilation)
docstring: Entry point for `intercept-cc` and `intercept-c++` compiler wrappers.
  
      It does generate execution report into target directory. And execute
      the wrapped compilation with the real compiler. The parameters for
      report and execution are from environment variables.
  
      Those parameters which for 'libear' library can't have meaningful
      values are faked.
docstring_summary: Entry point for `intercept-cc` and `intercept-c++` compiler wrappers.
docstring_tokens: Entry point for intercept - cc and intercept - c ++ compiler wrappers .
function: def intercept_build_wrapper(cplusplus):
      """ Entry point for `intercept-cc` and `intercept-c++` compiler wrappers.
  
      It does generate execution report into target directory. And execute
      the wrapped compilation with the real compiler. The parameters for
      report and execution are from environment variables.
  
      Those parameters which for 'libear' library can't have meaningful
      values are faked. """
  
      # initialize wrapper logging
      logging.basicConfig(format='intercept: %(levelname)s: %(message)s',
                          level=os.getenv('INTERCEPT_BUILD_VERBOSE', 'INFO'))
      # write report
      try:
          target_dir = os.getenv('INTERCEPT_BUILD_TARGET_DIR')
          if not target_dir:
              raise UserWarning('exec report target directory not found')
          pid = str(os.getpid())
          target_file = os.path.join(target_dir, pid + '.cmd')
          logging.debug('writing exec report to: %s', target_file)
          with open(target_file, 'ab') as handler:
              working_dir = os.getcwd()
              command = US.join(sys.argv) + US
              content = RS.join([pid, pid, 'wrapper', working_dir, command]) + GS
              handler.write(content.encode('utf-8'))
      except IOError:
          logging.exception('writing exec report failed')
      except UserWarning as warning:
          logging.warning(warning)
      # execute with real compiler
      compiler = os.getenv('INTERCEPT_BUILD_CXX', 'c++') if cplusplus \
          else os.getenv('INTERCEPT_BUILD_CC', 'cc')
      compilation = [compiler] + sys.argv[1:]
      logging.debug('execute compiler: %s', compilation)
      return subprocess.call(compilation)
function_tokens: def intercept_build_wrapper ( cplusplus ) : # initialize wrapper logging logging . basicConfig ( format = 'intercept: %(levelname)s: %(message)s' , level = os . getenv ( 'INTERCEPT_BUILD_VERBOSE' , 'INFO' ) ) # write report try : target_dir = os . getenv ( 'INTERCEPT_BUILD_TARGET_DIR' ) if not target_dir : raise UserWarning ( 'exec report target directory not found' ) pid = str ( os . getpid ( ) ) target_file = os . path . join ( target_dir , pid + '.cmd' ) logging . debug ( 'writing exec report to: %s' , target_file ) with open ( target_file , 'ab' ) as handler : working_dir = os . getcwd ( ) command = US . join ( sys . argv ) + US content = RS . join ( [ pid , pid , 'wrapper' , working_dir , command ] ) + GS handler . write ( content . encode ( 'utf-8' ) ) except IOError : logging . exception ( 'writing exec report failed' ) except UserWarning as warning : logging . warning ( warning ) # execute with real compiler compiler = os . getenv ( 'INTERCEPT_BUILD_CXX' , 'c++' ) if cplusplus else os . getenv ( 'INTERCEPT_BUILD_CC' , 'cc' ) compilation = [ compiler ] + sys . argv [ 1 : ] logging . debug ( 'execute compiler: %s' , compilation ) return subprocess . call ( compilation )