Skip to content

Commit

Permalink
fix: no magic string replacement in python packages (#966)
Browse files Browse the repository at this point in the history
## Description:
Packages had magic string replacement now they don't
  • Loading branch information
h4ck3rk3y committed Jul 24, 2023
1 parent a6a118d commit 8b0fa62
Showing 1 changed file with 2 additions and 11 deletions.
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

0 comments on commit 8b0fa62

Please sign in to comment.