Skip to content

Commit

Permalink
fix(cdk): place Python component binary in component root (#1419)
Browse files Browse the repository at this point in the history
**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 <tim.macdonald@lacework.net>
  • Loading branch information
tmac1973 authored Oct 19, 2023
1 parent 2ccd309 commit 6809238
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cli/cmd/component_dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6809238

Please sign in to comment.