Documentation
¶
Overview ¶
Package source defines the Source interface and Binary type used to resolve Go executables before they are wrapped into Python wheels.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binary ¶
type Binary struct {
Platform platforms.Platform
Data []byte
Filename string // "{name}" or "{name}.exe"
}
Binary is a resolved, ready-to-embed executable for one Platform.
type BuildSource ¶
type BuildSource struct {
// contains filtered or unexported fields
}
BuildSource compiles Go source code for each target platform using go build. It caches compiled binary bytes so that multiple wheel tags sharing the same os/arch pair (e.g. manylinux + musllinux on linux/amd64) do not trigger redundant compilations.
func NewBuildSource ¶
func NewBuildSource(pkg, modDir, ldflags string, stdout, stderr io.Writer) *BuildSource
NewBuildSource creates a BuildSource. Empty pkg and modDir default to "."; empty ldflags defaults to "-s". stdout and stderr receive progress and compiler output respectively; pass io.Discard to suppress.
type LocalSource ¶
type LocalSource struct {
// contains filtered or unexported fields
}
LocalSource reads binaries from local artifact paths provided by the caller.
func NewLocalSource ¶
func NewLocalSource(entries []string) (*LocalSource, error)
NewLocalSource creates a LocalSource from a slice of "goos/goarch:path" strings, as supplied via --artifact flags. All entries are validated eagerly; a non-nil error means at least one entry is invalid.
func (*LocalSource) Resolve ¶
func (s *LocalSource) Resolve( _ context.Context, name string, plats []platforms.Platform, ) ([]Binary, error)
Resolve reads each requested platform's binary from the local filesystem. Duplicate os/arch pairs (caused by multi-tag Linux platforms) are resolved only once.
type ReleaseSource ¶
type ReleaseSource struct {
// contains filtered or unexported fields
}
ReleaseSource downloads binaries from a GitHub Release, extracts them from their GoReleaser-produced archives, and caches archives on disk.
func NewReleaseSource ¶
func NewReleaseSource( repo, version, assets, cacheDir, token string, stdout io.Writer, ) *ReleaseSource
NewReleaseSource creates a ReleaseSource. repo must be "owner/name". version may be a full tag (e.g. "v1.2.3") or "" / "latest" to fetch the latest release. assets is a comma-separated list of explicit asset names; when empty, GoReleaser naming conventions are used. cacheDir defaults to $XDG_CACHE_HOME/gowheels when empty. token is an optional GitHub personal access token. stdout receives progress output; pass io.Discard to suppress.
func (*ReleaseSource) Resolve ¶
func (s *ReleaseSource) Resolve( ctx context.Context, name string, plats []platforms.Platform, ) ([]Binary, error)
Resolve fetches the GitHub release, matches each platform to an archive asset, downloads and extracts the binary, and returns one Binary per unique os/arch pair.
type Source ¶
type Source interface {
Resolve(ctx context.Context, name string, plats []platforms.Platform) ([]Binary, error)
}
Source resolves binaries for all requested platforms.
name is the binary base name (without .exe). plats lists the targets to resolve; the implementation may resolve fewer if a platform is unavailable. Each returned Binary must have its Platform.WheelTags populated so the wheel builder can emit one wheel per tag.