Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no magic string replacement in python packages #966

Merged
merged 1 commit into from
Jul 24, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -334,20 +334,11 @@ func (builtin *RunPythonCapabilities) TryResolveWith(instructionsAreEqual bool,
}

func setupRequiredPackages(ctx context.Context, builtin *RunPythonCapabilities) (*exec_result.ExecResult, error) {
var maybePackagesWithRuntimeValuesReplaced []string
for _, pythonPackage := range builtin.packages {
maybePackageWithRuntimeValueReplaced, err := magic_string_helper.ReplaceRuntimeValueInString(pythonPackage, builtin.runtimeValueStore)
if err != nil {
return nil, stacktrace.Propagate(err, "an error occurred while replacing runtime value in a package passed to run_python")
}
maybePackagesWithRuntimeValuesReplaced = append(maybePackagesWithRuntimeValuesReplaced, maybePackageWithRuntimeValueReplaced)
}

if len(maybePackagesWithRuntimeValuesReplaced) == 0 {
if len(builtin.packages) == 0 {
return nil, nil
}

packageInstallationSubCommand := fmt.Sprintf("%v %v", pipInstallCmd, strings.Join(maybePackagesWithRuntimeValuesReplaced, spaceDelimiter))
packageInstallationSubCommand := fmt.Sprintf("%v %v", pipInstallCmd, strings.Join(builtin.packages, spaceDelimiter))
packageInstallationCommand := []string{shellWrapperCommand, "-c", packageInstallationSubCommand}

executionResult, err := builtin.serviceNetwork.RunExec(
Expand Down