feat: add context parameter to PatchWheel function

This commit is contained in:
Denis Bilenko (aider) 2025-03-03 16:17:29 +01:00
parent fd8f65a9da
commit 174db9432c
2 changed files with 3 additions and 3 deletions

View File

@ -132,7 +132,7 @@ func readFile(file *zip.File) ([]byte, error) {
// PatchWheel patches a Python wheel file by updating its version in METADATA and RECORD.
// It returns the path to the new wheel.
func PatchWheel(path, outputDir string) (string, error) {
func PatchWheel(ctx context.Context, path, outputDir string) (string, error) {
r, err := zip.OpenReader(path)
if err != nil {
return "", err
@ -155,7 +155,7 @@ func PatchWheel(path, outputDir string) (string, error) {
}
baseVersion, distribution, err := parseMetadata(metadataContent)
log.Infof(ctx, "path=%s baseVersion=%s distribution=%s err=%s", path, baseVersion, distribution)
log.Infof(ctx, "path=%s baseVersion=%s distribution=%s", path, baseVersion, distribution)
if err != nil {
return "", err
}

View File

@ -103,7 +103,7 @@ func TestPatchWheel(t *testing.T) {
if err := os.Mkdir(outputDir, 0o755); err != nil {
t.Fatal(err)
}
patchedWheel, err := PatchWheel(origWheel, outputDir)
patchedWheel, err := PatchWheel(context.Background(), origWheel, outputDir)
if err != nil {
t.Fatalf("PatchWheel failed: %v", err)
}