Sha256: 20752f1a6a8874f95b95f55714c7e2445db99b7bb87be398e27dac19a5893c92

Contents?: true

Size: 996 Bytes

Versions: 2

Compression:

Stored size: 996 Bytes

Contents

module LicenseFinder
  class PipPackage < Package
    def initialize(name, version, install_path, pypi_def, options={})
      super options
      @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 license_names_from_spec
      license = pypi_def["license"]

      return [license] if license && license != "UNKNOWN"

      pypi_def.
        fetch("classifiers", []).
        select { |c| c.start_with?("License") }.
        map { |c| c.gsub(/^License.*::\s*(.*)$/, '\1') }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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