parameters: (flist,env,abspath)
return_statement: return 0
docstring: Scan a file list to decide if it's TeX- or LaTeX-flavored.
docstring_summary: Scan a file list to decide if it's TeX- or LaTeX-flavored.
docstring_tokens: Scan a file list to decide if it s TeX - or LaTeX - flavored .
function: def is_LaTeX(flist,env,abspath):
      """Scan a file list to decide if it's TeX- or LaTeX-flavored."""
  
      # We need to scan files that are included in case the
      # \documentclass command is in them.
  
      # get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS']
      savedpath = modify_env_var(env, 'TEXINPUTS', abspath)
      paths = env['ENV']['TEXINPUTS']
      if SCons.Util.is_List(paths):
          pass
      else:
          # Split at os.pathsep to convert into absolute path
          paths = paths.split(os.pathsep)
  
      # now that we have the path list restore the env
      if savedpath is _null:
          try:
              del env['ENV']['TEXINPUTS']
          except KeyError:
              pass # was never set
      else:
          env['ENV']['TEXINPUTS'] = savedpath
      if Verbose:
          print("is_LaTeX search path ",paths)
          print("files to search :",flist)
  
      # Now that we have the search path and file list, check each one
      for f in flist:
          if Verbose:
              print(" checking for Latex source ",str(f))
  
          content = f.get_text_contents()
          if LaTeX_re.search(content):
              if Verbose:
                  print("file %s is a LaTeX file" % str(f))
              return 1
          if Verbose:
              print("file %s is not a LaTeX file" % str(f))
  
          # now find included files
          inc_files = [ ]
          inc_files.extend( include_re.findall(content) )
          if Verbose:
              print("files included by '%s': "%str(f),inc_files)
          # inc_files is list of file names as given. need to find them
          # using TEXINPUTS paths.
  
          # search the included files
          for src in inc_files:
              srcNode = FindFile(src,['.tex','.ltx','.latex'],paths,env,requireExt=False)
              # make this a list since is_LaTeX takes a list.
              fileList = [srcNode,]
              if Verbose:
                  print("FindFile found ",srcNode)
              if srcNode is not None:
                  file_test = is_LaTeX(fileList, env, abspath)
  
              # return on first file that finds latex is needed.
              if file_test:
                  return file_test
  
          if Verbose:
              print(" done scanning ",str(f))
  
      return 0
function_tokens: def is_LaTeX ( flist , env , abspath ) : # We need to scan files that are included in case the # \documentclass command is in them. # get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS'] savedpath = modify_env_var ( env , 'TEXINPUTS' , abspath ) paths = env [ 'ENV' ] [ 'TEXINPUTS' ] if SCons . Util . is_List ( paths ) : pass else : # Split at os.pathsep to convert into absolute path paths = paths . split ( os . pathsep ) # now that we have the path list restore the env if savedpath is _null : try : del env [ 'ENV' ] [ 'TEXINPUTS' ] except KeyError : pass # was never set else : env [ 'ENV' ] [ 'TEXINPUTS' ] = savedpath if Verbose : print ( "is_LaTeX search path " , paths ) print ( "files to search :" , flist ) # Now that we have the search path and file list, check each one for f in flist : if Verbose : print ( " checking for Latex source " , str ( f ) ) content = f . get_text_contents ( ) if LaTeX_re . search ( content ) : if Verbose : print ( "file %s is a LaTeX file" % str ( f ) ) return 1 if Verbose : print ( "file %s is not a LaTeX file" % str ( f ) ) # now find included files inc_files = [ ] inc_files . extend ( include_re . findall ( content ) ) if Verbose : print ( "files included by '%s': " % str ( f ) , inc_files ) # inc_files is list of file names as given. need to find them # using TEXINPUTS paths. # search the included files for src in inc_files : srcNode = FindFile ( src , [ '.tex' , '.ltx' , '.latex' ] , paths , env , requireExt = False ) # make this a list since is_LaTeX takes a list. fileList = [ srcNode , ] if Verbose : print ( "FindFile found " , srcNode ) if srcNode is not None : file_test = is_LaTeX ( fileList , env , abspath ) # return on first file that finds latex is needed. if file_test : return file_test if Verbose : print ( " done scanning " , str ( f ) ) return 0