handle imports for command pkg the same as build and exe

This commit is contained in:
mlange-42 2023-02-01 13:22:14 +01:00
parent 7a98aa58fe
commit 3bbd58c8c1
1 changed files with 2 additions and 2 deletions

View File

@ -551,7 +551,7 @@ func (g *pyGen) genPkgWrapOut() {
// note: must generate import string at end as imports can be added during processing
impstr := ""
for _, im := range g.pkg.pyimports {
if g.mode == ModeGen || g.mode == ModeBuild {
if g.mode == ModeGen || g.mode == ModeBuild || g.mode == ModePkg {
if g.cfg.PkgPrefix != "" {
impstr += fmt.Sprintf("from %s import %s\n", g.cfg.PkgPrefix, im)
} else {
@ -653,7 +653,7 @@ func (g *pyGen) genPyWrapPreamble() {
impgenstr += fmt.Sprintf("import %s\n", "_"+g.cfg.Name)
}
impstr += fmt.Sprintf(GoPkgDefs, g.cfg.Name)
case g.mode == ModeGen || g.mode == ModeBuild:
case g.mode == ModeGen || g.mode == ModeBuild || g.mode == ModePkg:
if g.cfg.PkgPrefix != "" {
for _, name := range impgenNames {
impgenstr += fmt.Sprintf("from %s import %s\n", g.cfg.PkgPrefix, name)