wheelegg

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package wheelegg extracts wheel and egg files.

Index

Constants

View Source
const (
	// Name is the unique name of this extractor.
	Name = "python/wheelegg"
)

Variables

View Source
var ErrSizeNotSet = errors.New("input.Info is nil, but should have Size set")

ErrSizeNotSet will trigger when Info.Size() is not set.

Functions

This section is empty.

Types

type Config

type Config struct {
	// MaxFileSize is the maximum file size an extractor will unmarshal.
	// If Extract gets a bigger file, it will return an error.
	MaxFileSize int64
}

Config is the configuration for the Extractor.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration for the wheel/egg extractor.

type Extractor

type Extractor struct {
	// contains filtered or unexported fields
}

Extractor extracts python packages from wheel/egg files.

func New

func New(cfg Config) *Extractor

New returns a wheel/egg extractor.

For most use cases, initialize with: ``` e := New(DefaultConfig()) ```

func (Extractor) Extract

func (e Extractor) Extract(ctx context.Context, input *extractor.ScanInput) ([]*extractor.Inventory, error)

Extract extracts packages from wheel/egg files passed through the scan input. For .egg files, input.Info.Size() is required to unzip the file.

func (Extractor) FileRequired

func (e Extractor) FileRequired(path string, _ fs.FileMode) bool

FileRequired returns true if the specified file matches python Metadata file patterns.

func (Extractor) Name

func (e Extractor) Name() string

Name of the extractor.

func (Extractor) ToCPEs

func (e Extractor) ToCPEs(i *extractor.Inventory) ([]string, error)

ToCPEs is not applicable as this extractor does not infer CPEs from the Inventory.

func (Extractor) ToPURL

func (e Extractor) ToPURL(i *extractor.Inventory) (*purl.PackageURL, error)

ToPURL converts an inventory created by this extractor into a PURL.

func (Extractor) Version

func (e Extractor) Version() int

Version of the extractor.

type PythonPackageMetadata

type PythonPackageMetadata struct {
	Author      string `json:"author"`
	AuthorEmail string `json:"authorEmail"`
}

PythonPackageMetadata holds parsing information from a python egg or wheel package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL