adapt modifies the entrypoint command for the maker tool.
(cmd []string, scriptCmd []string)
| 622 | return cmd, nil |
| 623 | } |
| 624 | |
| 625 | // MakerEntrypointAdapter implements the entrypointAdapter interface for |
| 626 | // the maker tool. |
| 627 | type MakerEntrypointAdapter struct { |
| 628 | TargetPlatform string |
| 629 | } |
| 630 | |
| 631 | // adapt modifies the entrypoint command for the maker tool. |
| 632 | func (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 { |
nothing calls this directly
no test coverage detected