code: def scan_recurse(self, node, path=()):
          
  
          path_dict = dict(list(path))
          
          queue = [] 
          queue.extend( self.scan(node) )
          seen = {}
  
          # This is a hand-coded DSU (decorate-sort-undecorate, or
          # Schwartzian transform) pattern.  The sort key is the raw name
          # of the file as specifed on the \include, \input, etc. line.
          # TODO: what about the comment in the original Classic scanner:
          # """which lets
          # us keep the sort order constant regardless of whether the file
          # is actually found in a Repository or locally."""
          nodes = []
          source_dir = node.get_dir()
          #for include in includes:
          while queue:
              
              include = queue.pop()
              inc_type, inc_subdir, inc_filename = include
  
              try:
                  if seen[inc_filename] == 1:
                      continue
              except KeyError:
                  seen[inc_filename] = 1
  
              #
              # Handle multiple filenames in include[1]
              #
              n, i = self.find_include(include, source_dir, path_dict)
              if n is None:
                  # Do not bother with 'usepackage' warnings, as they most
                  # likely refer to system-level files
                  if inc_type != 'usepackage':
                      SCons.Warnings.warn(SCons.Warnings.DependencyWarning,
                                          "No dependency generated for file: %s (included from: %s) -- file not found" % (i, node))
              else:
                  sortkey = self.sort_key(n)
                  nodes.append((sortkey, n))
                  # recurse down
                  queue.extend( self.scan(n, inc_subdir) )
  
          return [pair[1] for pair in sorted(nodes)]
docs: do a recursive scan of the top level target file
          This lets us search for included files based on the
          directory of the main file just as latex does