Skip to content

Commit 9c83d3f

Browse files
author
Randall C. O'Reilly
committed
update support matrix, add setup.py example in README, gofmt files.
1 parent cc0f2ef commit 9c83d3f

File tree

9 files changed

+28
-10
lines changed

9 files changed

+28
-10
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,14 @@ $ docker run -it --rm go-python/gopy
251251
To know what features are supported on what backends, please refer to the
252252
[Support matrix ](https://github.com/go-python/gopy/blob/master/SUPPORT_MATRIX.md).
253253
254+
## setup.py
255+
256+
Here's an example for how to use `setup.py` with gopy to make an installable package:
257+
https://github.com/natun-ai/labsdk/blob/master/setup.py
258+
259+
Also, see this for cross-platform build:
260+
https://github.com/natun-ai/labsdk/blob/master/.github/workflows/wheels.yaml
261+
254262
## Troubleshooting
255263
256264
### python version mismatches

SUPPORT_MATRIX.md

+1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ _examples/sliceptr | yes | yes
2929
_examples/slices | yes | yes
3030
_examples/structs | yes | yes
3131
_examples/unicode | no | yes
32+
_examples/variadic | no | yes
3233
_examples/vars | yes | yes

_examples/cpkg/run.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
//go:build ignore
56
// +build ignore
67

78
package main

_examples/variadic/variadic.go

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
// Copyright 2022 The go-python Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
15
package variadic
26

37
/////////////// Non Variadic //////////////
4-
func NonVariFunc(arg1 int, arg2 []int, arg3 int) int{
8+
func NonVariFunc(arg1 int, arg2 []int, arg3 int) int {
59
total := arg1
610
for _, num := range arg2 {
711
total += num
@@ -12,7 +16,7 @@ func NonVariFunc(arg1 int, arg2 []int, arg3 int) int{
1216
}
1317

1418
/////////////// Variadic Over Int //////////////
15-
func VariFunc(vargs ...int) int{
19+
func VariFunc(vargs ...int) int {
1620
total := 0
1721
for _, num := range vargs {
1822
total += num
@@ -26,15 +30,15 @@ type IntStrUct struct {
2630
}
2731

2832
func NewIntStrUct(n int) IntStrUct {
29-
return IntStrUct {
30-
p:n,
33+
return IntStrUct{
34+
p: n,
3135
}
32-
}
36+
}
3337

34-
func VariStructFunc(vargs ...IntStrUct) int{
38+
func VariStructFunc(vargs ...IntStrUct) int {
3539
total := 0
3640
for _, inst := range vargs {
37-
total += inst.p
41+
total += inst.p
3842
}
3943
return total
4044
}
@@ -48,7 +52,7 @@ func (is *IntStrUct) Number() int {
4852
return is.p
4953
}
5054

51-
func VariInterFaceFunc(vargs ...IntInterFace) int{
55+
func VariInterFaceFunc(vargs ...IntInterFace) int {
5256
total := 0
5357
for _, inst := range vargs {
5458
total += inst.Number()

bind/gen_func.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func (g *pyGen) genFuncSig(sym *symbol, fsym *Func) bool {
100100
}
101101
}
102102

103-
if i!=nargs-1 || !fsym.isVariadic {
103+
if i != nargs-1 || !fsym.isVariadic {
104104
wpArgs = append(wpArgs, anm)
105105
}
106106
}
@@ -303,7 +303,7 @@ if __err != nil {
303303
default:
304304
na = anm
305305
}
306-
if i == len(args) - 1 && fsym.isVariadic {
306+
if i == len(args)-1 && fsym.isVariadic {
307307
na = na + "..."
308308
}
309309
callArgs = append(callArgs, na)

main_darwin.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
//go:build darwin
56
// +build darwin
67

78
package main

main_unix.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
//go:build (linux && !android) || dragonfly || openbsd
56
// +build linux,!android dragonfly openbsd
67

78
package main

main_unix_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
//go:build !windows
56
// +build !windows
67

78
package main

main_windows_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright 2015 The go-python Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
4+
45
//go:build windows
56
// +build windows
67

0 commit comments

Comments
 (0)