From 4424aa16e9cd49e5015540b6ffede8a4097a6902 Mon Sep 17 00:00:00 2001 From: "emily.johnson" Date: Thu, 6 May 2021 15:59:46 -0500 Subject: [PATCH] Use dependencies provided by new pip bundle --- integration/offline_test.go | 5 +---- pip_install_process.go | 7 +++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/integration/offline_test.go b/integration/offline_test.go index af843b87..34655b2f 100644 --- a/integration/offline_test.go +++ b/integration/offline_test.go @@ -26,10 +26,7 @@ func testOffline(t *testing.T, context spec.G, it spec.S) { docker = occam.NewDocker() }) - // We intend to support offline builds but doesn't currently work because the - // pip installation process reaches out to the internet to install additional - // dependencies - context.Pend("when the buildpack is run with pack build in offline mode", func() { + context("when the buildpack is run with pack build in offline mode", func() { var ( image occam.Image container occam.Container diff --git a/pip_install_process.go b/pip_install_process.go index 8b48db6b..1dc5dc3a 100644 --- a/pip_install_process.go +++ b/pip_install_process.go @@ -3,9 +3,8 @@ package pip import ( "bytes" "fmt" - "os" - "github.com/paketo-buildpacks/packit/pexec" + "os" ) //go:generate faux --interface Executable --output fakes/executable.go @@ -33,15 +32,15 @@ func (p PipInstallProcess) Execute(srcPath, targetLayerPath string) error { err := p.executable.Execute(pexec.Execution{ // Install pip from source with the pip that comes pre-installed with cpython - Args: []string{"-m", "pip", "install", srcPath, "--user"}, + Args: []string{"-m", "pip", "install", srcPath, "--user", fmt.Sprintf("--find-links=%s", srcPath)}, // Set the PYTHONUSERBASE to ensure that pip is installed to the newly created target layer. Env: append(os.Environ(), fmt.Sprintf("PYTHONUSERBASE=%s", targetLayerPath)), Stdout: buffer, Stderr: buffer, }) - if err != nil { return fmt.Errorf("failed to configure pip:\n%s\nerror: %w", buffer.String(), err) } + return nil }