MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/buildpacks / adapt

Method adapt

pkg/python/python.go:624–650  ·  view source on GitHub ↗

adapt modifies the entrypoint command for the maker tool.

(cmd []string, scriptCmd []string)

Source from the content-addressed store, hash-verified

622 return cmd, nil
623}
624
625// MakerEntrypointAdapter implements the entrypointAdapter interface for
626// the maker tool.
627type MakerEntrypointAdapter struct {
628 TargetPlatform string
629}
630
631// adapt modifies the entrypoint command for the maker tool.
632func (a MakerEntrypointAdapter) adapt(cmd []string, scriptCmd []string) ([]string, error) {
633 commandToAdapt := cmd
634 if len(scriptCmd) > 0 {
635 // If scriptCmd is present, it takes precedence over cmd.
636 commandToAdapt = scriptCmd
637 }
638
639 if len(commandToAdapt) == 0 {
640 return commandToAdapt, nil
641 }
642 if commandToAdapt[0] == "python" || commandToAdapt[0] == "python3" {
643 return commandToAdapt, nil
644 }
645
646 targetDir := PipTargetDir()
647
648 pythonCmd := "python3"
649 var binPath string
650 if strings.HasPrefix(a.TargetPlatform, "windows") {
651 pythonCmd = "python"
652 binPath = strings.Join([]string{targetDir, "bin", commandToAdapt[0]}, "\\")
653 } else {

Callers

nothing calls this directly

Calls 1

PipTargetDirFunction · 0.85

Tested by

no test coverage detected