installer

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateScript

func GenerateScript(pythonPath string, cs ConsoleScript) []byte

GenerateScript creates a Python wrapper script for a console_scripts entry point. Output matches what pip generates.

func HashFile

func HashFile(path string) (hash string, size int64, err error)

HashFile computes the sha256 digest of a file and returns it in the format "sha256=<hex>" along with the file size.

func WriteInstaller

func WriteInstaller(distInfoDir string) error

WriteInstaller writes the INSTALLER file with "pipg" as the content.

func WriteRecord

func WriteRecord(distInfoDir string, entries []RecordEntry) error

WriteRecord writes a RECORD file to the dist-info directory. The RECORD file itself is listed with empty hash and size per PEP 376.

Types

type ConsoleScript

type ConsoleScript struct {
	Name   string // script name, e.g., "ipython"
	Module string // module path, e.g., "IPython"
	Attr   string // callable attribute, e.g., "start_ipython"
}

ConsoleScript represents a parsed console_scripts entry point.

func ParseEntryPoints

func ParseEntryPoints(path string) ([]ConsoleScript, error)

ParseEntryPoints reads an entry_points.txt file and returns the console_scripts.

type Installer

type Installer interface {
	Install(ctx context.Context, downloads []downloader.Result) error
}

Installer defines the interface for installing downloaded wheel files.

type Option

type Option func(*Service)

Option configures a Service.

func WithLogger

func WithLogger(l *slog.Logger) Option

WithLogger sets the structured logger.

type RecordEntry

type RecordEntry struct {
	Path string
	Hash string // sha256=<digest>
	Size int64
}

RecordEntry represents a single line in a RECORD file.

func InstallConsoleScripts

func InstallConsoleScripts(distInfoDir, binDir, pythonPath string) ([]RecordEntry, error)

InstallConsoleScripts reads entry_points.txt, generates wrapper scripts, and installs them to the bin directory. Returns RECORD entries for the scripts.

type Service

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

Service handles extracting wheel files into site-packages.

func New

func New(env *python.Environment, opts ...Option) *Service

New creates a new wheel installer targeting the given Python environment.

func (*Service) Install

func (s *Service) Install(ctx context.Context, downloads []downloader.Result) error

Install extracts all downloaded wheel files into site-packages. It handles .data directories, writes RECORD and INSTALLER files, and sets executable permissions on scripts.

Jump to

Keyboard shortcuts

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