diff --git a/detect.go b/detect.go index 446b8fa..d96c719 100644 --- a/detect.go +++ b/detect.go @@ -44,9 +44,7 @@ func Detect(logger scribe.Emitter) packit.DetectFunc { pipResult, err := pipinstall.Detect()(context) if err == nil { - return packit.DetectResult{ - Plan: pipResult.Plan, - }, nil + return pipResult, nil } else { logger.Detail("%s", err) } @@ -55,9 +53,7 @@ func Detect(logger scribe.Emitter) packit.DetectFunc { condaResult, err := conda.Detect()(context) if err == nil { - return packit.DetectResult{ - Plan: condaResult.Plan, - }, nil + return condaResult, nil } else { logger.Detail("%s", err) } @@ -69,9 +65,7 @@ func Detect(logger scribe.Emitter) packit.DetectFunc { )(context) if err == nil { - return packit.DetectResult{ - Plan: pipenvResult.Plan, - }, nil + return pipenvResult, nil } else { logger.Detail("%s", err) } diff --git a/pkg/packagers/uv/detect.go b/pkg/packagers/uv/detect.go index 0fd3b0f..c7e17d4 100644 --- a/pkg/packagers/uv/detect.go +++ b/pkg/packagers/uv/detect.go @@ -23,18 +23,18 @@ func Detect() packit.DetectFunc { return func(context packit.DetectContext) (packit.DetectResult, error) { lockfilePath := filepath.Join(context.WorkingDir, LockfileName) - lockFile, err := fs.Exists(lockfilePath) + lockfileExists, err := fs.Exists(lockfilePath) if err != nil { return packit.DetectResult{}, packit.Fail.WithMessage("failed trying to stat %s: %w", LockfileName, err) } - if !lockFile { - return packit.DetectResult{}, packit.Fail.WithMessage("no 'uv.lock' found") + if !lockfileExists { + return packit.DetectResult{}, packit.Fail.WithMessage("no '%s' found", LockfileName) } - vendor, err := fs.Exists(filepath.Join(context.WorkingDir, "vendor")) + vendorExists, err := fs.Exists(filepath.Join(context.WorkingDir, "vendor")) if err != nil { - return packit.DetectResult{}, packit.Fail.WithMessage("failed trying to stat %s: %w", LockfileName, err) + return packit.DetectResult{}, packit.Fail.WithMessage("failed trying to stat vendor dir: %w", err) } requires := []packit.BuildPlanRequirement{ @@ -46,7 +46,7 @@ func Detect() packit.DetectFunc { }, } - if vendor { + if vendorExists { parser := NewLockfileParser() version, _ := parser.ParsePythonVersion(lockfilePath) diff --git a/pkg/packagers/uv/uv_runner.go b/pkg/packagers/uv/uv_runner.go index 497dede..8dcda52 100644 --- a/pkg/packagers/uv/uv_runner.go +++ b/pkg/packagers/uv/uv_runner.go @@ -94,7 +94,7 @@ func (c UvRunner) Execute(uvLayerPath string, uvCachePath string, workingDir str vendorDir := filepath.Join(workingDir, "vendor") - exists, err := fs.Exists(vendorDir) + vendorExists, err := fs.Exists(vendorDir) if err != nil { return err } @@ -107,7 +107,7 @@ func (c UvRunner) Execute(uvLayerPath string, uvCachePath string, workingDir str env := append(os.Environ(), fmt.Sprintf("HOME=%s", uvLayerPath)) - if exists { + if vendorExists { args = append(args, "--offline", "--python", "/layers/paketo-buildpacks_cpython/cpython/bin/python") env = append(env, "LD_LIBRARY_PATH=/layers/paketo-buildpacks_cpython/cpython/lib") } @@ -130,7 +130,7 @@ func (c UvRunner) Execute(uvLayerPath string, uvCachePath string, workingDir str combinedFindLinks := []string{userFindLinks, findLinks} - if exists { + if vendorExists { combinedFindLinks = append(combinedFindLinks, vendorDir) args = offlineArgs(venvPath, workingDir) } else {