Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,23 @@ branches:
- master

environment:
GOPATH: C:\gopath
GOROOT: C:\go121
GOROOT: C:\go122
GOPY_APPVEYOR_CI: '1'
GOTRACEBACK: 'crash'
CPYTHON3DIR: "C:\\Python311-x64"
PATH: '%GOPATH%\bin;%GOROOT%\bin;%CPYTHON3DIR%;%CPYTHON3DIR%\\Scripts;C:\msys64\mingw64\bin;C:\msys64\usr\bin\;%PATH%'

stack: go 1.21
PATH: 'C:\go122\bin;%USERPROFILE%\go\bin;%CPYTHON3DIR%;%CPYTHON3DIR%\\Scripts;C:\msys64\mingw64\bin;C:\msys64\usr\bin\;%PATH%'
Copy link
Author

@kousu kousu Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appveyor doesn't seem to respect envs set, see e.g. this run, that's why the path to go is hardcoded.

I wonder therefore if the python paths are also wrong. But the build is passing and I don't want this patch to be a complete overhaul (b-long already did that)


build_script:
- python --version
- "%CPYTHON3DIR%\\python --version"
- "%CPYTHON3DIR%\\python -m pip install --upgrade pip"
- "%CPYTHON3DIR%\\python -m pip install cffi"
- "%CPYTHON3DIR%\\python -m pip install pybindgen"
- "python -m pip install --upgrade pip"
- "python -m pip install cffi"
- "python -m pip install pybindgen"
- "where go"
- "C:\\go122\\bin\\go.exe version"
- go version
- go env
- go get -v -t ./...
- go install golang.org/x/tools/cmd/goimports@latest
- go install golang.org/x/tools/cmd/goimports

test_script:
- go test ./...
6 changes: 4 additions & 2 deletions bind/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ package main
%[3]s
// #define Py_LIMITED_API // need full API for PyRun*
#include <Python.h>
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 202311L)
typedef uint8_t bool;
#endif
// static inline is trick for avoiding need for extra .c file
// the following are used for build value -- switch on reflect.Kind
// or the types equivalent
Expand Down Expand Up @@ -409,8 +411,8 @@ build:
# goimports is needed to ensure that the imports list is valid
$(GOIMPORTS) -w %[1]s.go
# this will otherwise be built during go build and may be out of date
- rm %[1]s.c
echo "typedef uint8_t bool;" > %[1]s_go.h
- rm %[1]s.c
printf "#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 202311L)\ntypedef uint8_t bool;\n#endif\n" > %[1]s_go.h
# this will fail but is needed to generate the .c file that then allows go build to work
- $(PYTHON) build.py >/dev/null 2>&1
# generate %[1]s_go.h from %[1]s.go -- unfortunately no way to build .h only
Expand Down
2 changes: 1 addition & 1 deletion cmd_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func runBuild(mode bind.BuildMode, cfg *BuildCfg) error {

if mode == bind.ModeExe {
of, err := os.Create(buildname + ".h") // overwrite existing
fmt.Fprintf(of, "typedef uint8_t bool;\n")
fmt.Fprintf(of, "#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 202311L)\ntypedef uint8_t bool;\n#endif\n")
of.Close()

fmt.Printf("%v build.py # will fail, but needed to generate .c file\n", cfg.VM)
Expand Down
9 changes: 6 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
module github.com/go-python/gopy

go 1.19
go 1.22.0

require (
github.com/gonuts/commander v0.1.0
github.com/gonuts/flag v0.1.0
github.com/pkg/errors v0.9.1
golang.org/x/tools v0.16.0
golang.org/x/tools v0.26.0
)

require golang.org/x/mod v0.14.0 // indirect
require (
golang.org/x/mod v0.21.0 // indirect
golang.org/x/sync v0.8.0 // indirect
)
14 changes: 6 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ github.com/gonuts/flag v0.1.0 h1:fqMv/MZ+oNGu0i9gp0/IQ/ZaPIDoAZBOBaJoV7viCWM=
github.com/gonuts/flag v0.1.0/go.mod h1:ZTmTGtrSPejTo/SRNhCqwLTmiAgyBdCkLYhHrAoBdz4=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM=
golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=