update support matrix, add setup.py example in README, gofmt files.

This commit is contained in:
Randall C. O'Reilly 2022-06-19 01:58:22 -07:00
parent cc0f2ef591
commit 9c83d3f7c3
9 changed files with 28 additions and 10 deletions

View File

@ -251,6 +251,14 @@ $ docker run -it --rm go-python/gopy
To know what features are supported on what backends, please refer to the
[Support matrix ](https://github.com/go-python/gopy/blob/master/SUPPORT_MATRIX.md).
## setup.py
Here's an example for how to use `setup.py` with gopy to make an installable package:
https://github.com/natun-ai/labsdk/blob/master/setup.py
Also, see this for cross-platform build:
https://github.com/natun-ai/labsdk/blob/master/.github/workflows/wheels.yaml
## Troubleshooting
### python version mismatches

View File

@ -29,4 +29,5 @@ _examples/sliceptr | yes | yes
_examples/slices | yes | yes
_examples/structs | yes | yes
_examples/unicode | no | yes
_examples/variadic | no | yes
_examples/vars | yes | yes

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
package main

View File

@ -1,7 +1,11 @@
// Copyright 2022 The go-python Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package variadic
/////////////// Non Variadic //////////////
func NonVariFunc(arg1 int, arg2 []int, arg3 int) int{
func NonVariFunc(arg1 int, arg2 []int, arg3 int) int {
total := arg1
for _, num := range arg2 {
total += num
@ -12,7 +16,7 @@ func NonVariFunc(arg1 int, arg2 []int, arg3 int) int{
}
/////////////// Variadic Over Int //////////////
func VariFunc(vargs ...int) int{
func VariFunc(vargs ...int) int {
total := 0
for _, num := range vargs {
total += num
@ -26,15 +30,15 @@ type IntStrUct struct {
}
func NewIntStrUct(n int) IntStrUct {
return IntStrUct {
p:n,
return IntStrUct{
p: n,
}
}
}
func VariStructFunc(vargs ...IntStrUct) int{
func VariStructFunc(vargs ...IntStrUct) int {
total := 0
for _, inst := range vargs {
total += inst.p
total += inst.p
}
return total
}
@ -48,7 +52,7 @@ func (is *IntStrUct) Number() int {
return is.p
}
func VariInterFaceFunc(vargs ...IntInterFace) int{
func VariInterFaceFunc(vargs ...IntInterFace) int {
total := 0
for _, inst := range vargs {
total += inst.Number()

View File

@ -100,7 +100,7 @@ func (g *pyGen) genFuncSig(sym *symbol, fsym *Func) bool {
}
}
if i!=nargs-1 || !fsym.isVariadic {
if i != nargs-1 || !fsym.isVariadic {
wpArgs = append(wpArgs, anm)
}
}
@ -303,7 +303,7 @@ if __err != nil {
default:
na = anm
}
if i == len(args) - 1 && fsym.isVariadic {
if i == len(args)-1 && fsym.isVariadic {
na = na + "..."
}
callArgs = append(callArgs, na)

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build darwin
// +build darwin
package main

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (linux && !android) || dragonfly || openbsd
// +build linux,!android dragonfly openbsd
package main

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !windows
// +build !windows
package main

View File

@ -1,6 +1,7 @@
// Copyright 2015 The go-python Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build windows
// +build windows