MCPcopy Index your code
hub / github.com/go-python/gopy / GenPyPkgSetup

Function GenPyPkgSetup

pkgsetup.go:123–170  ·  view source on GitHub ↗

GenPyPkgSetup generates python package setup files

(cfg *BuildCfg, user, version, author, email, desc, url string)

Source from the content-addressed store, hash-verified

121
122// GenPyPkgSetup generates python package setup files
123func GenPyPkgSetup(cfg *BuildCfg, user, version, author, email, desc, url string) error {
124 os.Chdir(cfg.OutputDir)
125
126 dashUser := user
127 if user != "" {
128 dashUser = "-" + user
129 }
130
131 sf, err := os.Create(filepath.Join(cfg.OutputDir, "setup.py"))
132 if err != nil {
133 return err
134 }
135 fmt.Fprintf(sf, setupTempl, cfg.Name, dashUser, version, author, email, desc, url)
136 sf.Close()
137
138 mi, err := os.Create(filepath.Join(cfg.OutputDir, "MANIFEST.in"))
139 if err != nil {
140 return err
141 }
142 fmt.Fprintf(mi, manifestTempl)
143 mi.Close()
144
145 lf, err := os.Create(filepath.Join(cfg.OutputDir, "LICENSE"))
146 if err != nil {
147 return err
148 }
149 fmt.Fprintf(lf, bsdLicense, cfg.Name)
150 lf.Close()
151
152 rf, err := os.Create(filepath.Join(cfg.OutputDir, "README.md"))
153 if err != nil {
154 return err
155 }
156 fmt.Fprintf(rf, readmeTempl, cfg.Name, desc)
157 rf.Close()
158
159 _, pyonly := filepath.Split(cfg.VM)
160 gencmd := bind.CmdStrToMakefile(cfg.Cmd)
161
162 mf, err := os.Create(filepath.Join(cfg.OutputDir, "Makefile"))
163 if err != nil {
164 return err
165 }
166 fmt.Fprintf(mf, makefileTempl, cfg.Name, cfg.Cmd, gencmd, pyonly)
167 mf.Close()
168
169 return err
170}

Callers 2

gopyRunCmdPkgFunction · 0.85
gopyRunCmdExeFunction · 0.85

Calls 1

CmdStrToMakefileFunction · 0.92

Tested by

no test coverage detected