()
| 764 | } |
| 765 | |
| 766 | func (g *pyGen) genAll() { |
| 767 | g.gofile.Printf("\n// ---- Package: %s ---\n", g.pkg.Name()) |
| 768 | |
| 769 | g.gofile.Printf("\n// ---- Types ---\n") |
| 770 | g.pywrap.Printf("\n# ---- Types ---\n") |
| 771 | names := current.names() |
| 772 | for _, n := range names { |
| 773 | sym := current.sym(n) |
| 774 | if sym.gopkg.Path() != g.pkg.pkg.Path() { // sometimes the package is not the same!! yikes! |
| 775 | continue |
| 776 | } |
| 777 | if !sym.isType() { |
| 778 | continue |
| 779 | } |
| 780 | g.genType(sym, false, false) // not exttypes |
| 781 | } |
| 782 | |
| 783 | g.pywrap.Printf("\n\n#---- Enums from Go (collections of consts with same type) ---\n") |
| 784 | // conditionally add Enum support because it is an external dependency in py2 |
| 785 | if len(g.pkg.enums) > 0 { |
| 786 | g.pywrap.Printf("from enum import Enum\n\n") |
| 787 | } |
| 788 | for _, e := range g.pkg.enums { |
| 789 | g.genEnum(e) |
| 790 | } |
| 791 | |
| 792 | g.pywrap.Printf("\n\n#---- Constants from Go: Python can only ask that you please don't change these! ---\n") |
| 793 | for _, c := range g.pkg.consts { |
| 794 | g.genConst(c) |
| 795 | } |
| 796 | |
| 797 | g.gofile.Printf("\n\n// ---- Global Variables: can only use functions to access ---\n") |
| 798 | g.pywrap.Printf("\n\n# ---- Global Variables: can only use functions to access ---\n") |
| 799 | for _, v := range g.pkg.vars { |
| 800 | g.genVar(v) |
| 801 | } |
| 802 | |
| 803 | g.gofile.Printf("\n\n// ---- Interfaces ---\n") |
| 804 | g.pywrap.Printf("\n\n# ---- Interfaces ---\n") |
| 805 | for _, ifc := range g.pkg.ifaces { |
| 806 | g.genInterface(ifc) |
| 807 | } |
| 808 | |
| 809 | g.gofile.Printf("\n\n// ---- Structs ---\n") |
| 810 | g.pywrap.Printf("\n\n# ---- Structs ---\n") |
| 811 | g.pkg.sortStructEmbeds() |
| 812 | for _, s := range g.pkg.structs { |
| 813 | g.genStruct(s) |
| 814 | } |
| 815 | |
| 816 | g.gofile.Printf("\n\n// ---- Slices ---\n") |
| 817 | g.pywrap.Printf("\n\n# ---- Slices ---\n") |
| 818 | for _, s := range g.pkg.slices { |
| 819 | g.genSlice(s.sym, false, false, s) |
| 820 | } |
| 821 | |
| 822 | g.gofile.Printf("\n\n// ---- Maps ---\n") |
| 823 | g.pywrap.Printf("\n\n# ---- Maps ---\n") |
no test coverage detected