Skip to content

Commit

Permalink
Use dependencies provided by new pip bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
emily.johnson authored and arjun024 committed May 7, 2021
1 parent c63007c commit 4424aa1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 1 addition & 4 deletions integration/offline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions pip_install_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

0 comments on commit 4424aa1

Please sign in to comment.