def process_lilypond_file(path, leaf, opts)
      # path is expected to be absolute
      return if @processed_files[path]

      ly_content = IO.read(path)
      dir = File.dirname(path)

      # Parse lilypond file for \include and \require
      location = {path: path, line: 0}
      ly_content.each_line do |line|
        location[:line] += 1
        line.scan(DEP_RE) do |type, ref|
          case type
          when LYP_INCLUDE, LYP_LOAD, INCLUDE, PINCLUDE, PINCLUDE_ONCE
            process_include_command(ref, dir, leaf, opts, location)
          when LYP_REQUIRE, REQUIRE
            process_require_command(ref, dir, leaf, opts, location)
          end
        end
      end

      # process any external requires (supplied using the -r command line option)
      if @ext_require
        @ext_require.each do |p|
          process_require_command(p, dir, leaf, opts, {ext_require: true})
        end
        @ext_require = nil
      end

      @processed_files[path] = true
    rescue Errno::ENOENT
      error("Could not find file #{path}")
    end
def process_lilypond_file(path, leaf, opts)
      # path is expected to be absolute
      return if @processed_files[path]

      ly_content = IO.read(path)
      dir = File.dirname(path)

      # Parse lilypond file for \include and \require
      location = {path: path, line: 0}
      ly_content.each_line do |line|
        location[:line] += 1
        line.scan(DEP_RE) do |type, ref|
          case type
          when LYP_INCLUDE, LYP_LOAD, INCLUDE, PINCLUDE, PINCLUDE_ONCE
            process_include_command(ref, dir, leaf, opts, location)
          when LYP_REQUIRE, REQUIRE
            process_require_command(ref, dir, leaf, opts, location)
          end
        end
      end

      # process any external requires (supplied using the -r command line option)
      if @ext_require
        @ext_require.each do |p|
          process_require_command(p, dir, leaf, opts, {ext_require: true})
        end
        @ext_require = nil
      end

      @processed_files[path] = true
    rescue Errno::ENOENT
      error("Could not find file #{path}")
    end
Scans a lilypond file for \require and \(p)include statements. An included
 file is queued for processing. For required packages, search for suitable
 versions of the package and add them to the tree.

 The leaf argument is a pointer to the current leaf on the tree on which to
 add dependencies. This is how transitive dependencies are represented.