Sha256: 54aaf843dc0be7822523496f9a359844ee79b928fc3ef8e5861863b2e0469912

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

module LicenseFinder
  class PipPackage < Package
    def initialize(name, version, install_path, pypi_def)
      @name = name
      @version = version
      @install_path = install_path
      @pypi_def = pypi_def
    end

    attr_reader :name, :version

    def summary
      pypi_def.fetch("summary", "")
    end

    def description
      pypi_def.fetch("description", "")
    end

    def homepage
      pypi_def["home_page"]
    end

    def children
      [] # no way to determine child deps from pip (maybe?)
    end

    def groups
      [] # no concept of dev/test groups in pip (maybe?)
    end

    private

    attr_reader :install_path, :pypi_def

    def licenses_from_spec
      license = pypi_def["license"]

      if pypi_def["license"] && pypi_def["license"] != "UNKNOWN"
        return [license]
      else
        classifiers = pypi_def.fetch("classifiers", [])
        classifiers.map do |c|
          if c.start_with?("License")
            c.gsub(/^License.*::\s*(.*)$/, '\1')
          end
        end.compact
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
license_finder-1.0.0.0 lib/license_finder/package_managers/pip_package.rb
license_finder-1.0.0.0-java lib/license_finder/package_managers/pip_package.rb