Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/packagers/uv/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -46,7 +46,7 @@ func Detect() packit.DetectFunc {
},
}

if vendor {
if vendorExists {
parser := NewLockfileParser()
version, _ := parser.ParsePythonVersion(lockfilePath)

Expand Down
6 changes: 3 additions & 3 deletions pkg/packagers/uv/uv_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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")
}
Expand All @@ -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 {
Expand Down
Loading