mirror of https://github.com/databricks/cli.git
feat: add context parameter to PatchWheel function
This commit is contained in:
parent
fd8f65a9da
commit
174db9432c
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue