From 6809238b2efbeb2f687ce71c9862f4add6dce569 Mon Sep 17 00:00:00 2001 From: Timothy MacDonald Date: Wed, 18 Oct 2023 19:24:51 -0500 Subject: [PATCH] fix(cdk): place Python component binary in component root (#1419) **Summary** The python pyinstaller build command was creating the component binary in subdirectory, not the component root directory. This prevented the lacework cli from executing the component. **How did you test this change?** 1. compiled the lacework cli 2. tested the creation of a new python component with scaffolding 3. tested that the cli could execute the component after build https://lacework.atlassian.net/browse/GROW-2491 Signed-off-by: Timothy MacDonald --- cli/cmd/component_dev.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cli/cmd/component_dev.go b/cli/cmd/component_dev.go index c2656bc99..96193e479 100644 --- a/cli/cmd/component_dev.go +++ b/cli/cmd/component_dev.go @@ -369,17 +369,24 @@ func cdkPythonScaffolding(component *lwcomponent.Component) error { return err } - _, err = f.WriteString("build = \"poetry run pyinstaller src/") + _, err = f.WriteString("build.shell = \"poetry run pyinstaller src/") if err != nil { return err } _, err = f.WriteString(fmt.Sprintf( - "%s/__main__.py --collect-submodules application -D --name %s --distpath .\"\n", + "%s/__main__.py --collect-submodules application -D --name %s --distpath dist;", component.Name, component.Name, )) if err != nil { return err } + _, err = f.WriteString(fmt.Sprintf( + " mv dist/%s/* .\"\n", + component.Name, + )) + if err != nil { + return err + } _, err = f.WriteString(fmt.Sprintf( "clean = \"rm -r build/ %s %s.spec\"\n", component.Name, component.Name,