Commit Graph

246 Commits

Author SHA1 Message Date
Sebastien Binet 9240dfc24a all: first stab at no-cgo-ptr 2018-01-06 20:35:52 +01:00
Sebastien Binet 7cb9dcd10f travis: update for new trusty image 2017-09-15 16:51:56 +02:00
Sebastien Binet d25a96cca0 gopy: make gopy.py module python-3 compliant 2017-09-15 16:41:22 +02:00
Sebastien Binet df98bda46e gopy: remove 1.{5,6}.x from travis, add 1.9.x 2017-08-27 10:19:40 +02:00
Dong-hee Na b237d1d6c6 bind/cffi: support built-in maps
* Support built-in maps.
* Support maps as arguments of a function.
* Support python dictionary as function parameters.
* Add 'maps' test
2017-08-10 20:17:03 +02:00
Sebastien Binet 7138b3be0b gopy: add -work switch to gopy-bind 2017-08-10 17:01:26 +02:00
Sebastien Binet 70ab2b0b03 gopy: add support for sub-tests
This CL adds support for sub-tests for Go >= 1.7 and adds the needed
fallback code for Go < 1.7.

This allows to run sub-tests in parallel, where each sub-test tests a
backend (py2-cffi, py3-cffi, py3, ...).
2017-08-10 16:26:07 +02:00
Sebastien Binet b2daa0909e gopy: add go vet test 2017-08-10 09:11:48 +02:00
Sebastien Binet 98d59f0c89 all: apply go-vet fixes 2017-08-10 09:11:48 +02:00
Sebastien Binet 0ab5a46669 gopy: apply golint fixes 2017-08-10 09:11:48 +02:00
Dong-hee Na a446b7dcef [cffi]: Updates README.md 2017-08-08 16:52:30 +02:00
Sebastien Binet 0c9b04eaed travis: allow go@master to fail 2017-08-08 16:50:54 +02:00
Sebastien Binet f4c09c97bf travis: remove python3 2017-08-08 16:50:54 +02:00
Sebastien Binet 3fe2851d10 gopy: add tests for pypy(2|3)-cffi 2017-08-08 16:50:54 +02:00
Sebastien Binet 3d6439252d gopy: add test-backends discoverability + pypy(2|3)-cffi 2017-08-08 16:50:54 +02:00
Sebastien Binet a5c53887f1 travis: add python3 2017-08-08 16:50:54 +02:00
Sebastien Binet e890dfda48 travis: migrate to ubuntu-trusty 2017-08-08 16:50:54 +02:00
Sebastien Binet 06d0b8de69 gopy: split cffi tests into cffi-py2 and cffi-py3
This CL renames the old cffi tests as cffi-py2, and adds another
backend: cffi-py3.

cffi-py2 generates a wrapped package with cffi and runs it with python2.
cffi-py3 generates a wrapped package with cffi and runs it with python3.
2017-08-08 16:50:54 +02:00
Sebastien Binet ac0950829d gopy: make tests py2/py3 compliant
This CL modifies test.py scripts to detect when run with a Python3
interpreter.
xrange disappeared in Python3.
Reintroduce it as an alias for range.
2017-08-08 16:50:54 +02:00
Sebastien Binet b274bce62c bind/cffi: decode Go strings as utf8
Go strings are UTF-8 strings.
Decode them as such on the CFFI side.
2017-08-08 16:50:54 +02:00
Sebastien Binet 23f5f65739 bind/cffi: handle strings from error.Error
This CL introduces a convenience function cffi_cgopy_cnv_c2py_errstring
to properly handle (and decode) strings coming from error.Error calls.
2017-08-08 16:50:54 +02:00
Sebastien Binet 76264b4453 gopy: add a simple test for strings 2017-08-08 16:50:54 +02:00
Sebastien Binet c4f895b387 gopy,_examples/hi: unify py2/cffi tests
This CL unifies the test harnesses for the cpython2 and cffi backends.

testPkg now takes a list of backends (via the table value) to compile
against and infers the list of Python VMs to run the resulting artefact
with.

So:
 - backend=py2  => python2
 - backend=py3  => python3
 - backend=cffi => python2 (and, one day, python3 too)

Fixes go-python/gopy#100.
2017-08-07 15:01:47 +02:00
Sebastien Binet c094c79ccc bind/py2: raise array/slice index out of range 2017-08-07 15:01:47 +02:00
Sebastien Binet 9cd1691ec2 bind/{cpy,cffi}: attached doc of Go vars if available
This CL adds the doc-string of Go variables (if available) to the python
getter and setter functions, for both CPython2 and CFFI.

Update TestBindVars accordingly.
2017-08-07 14:40:25 +02:00
Sebastien Binet 20ca91fff1 bind/py2: attach documentation for vars get/set 2017-08-07 14:40:25 +02:00
Dong-hee Na 31d6377e11 cffi: Implement wrapping of functions with slices/arrays of builtin arguments 2017-08-05 19:00:21 +02:00
Sebastien Binet 61290c18b0 gopy,bind: drop package name out of tp_name
Before this CL we used to prepend the Go package name of a struct to the
python name of the corresponding python class:

>>> import pkg
>>> f = pkg.Foo()
>>> f.bar
caught error: 'pkg.Foo' object has no attribute 'bar'

This CL drops 'pkg' to make the resulting string follow CPython
convention:

>>> import pkg
>>> f = pkg.Foo()
>>> f.bar
caught error: 'Foo' object has no attribute 'bar'

Fixes go-python#gopy/119.
2017-08-04 19:06:13 +02:00
Sebastien Binet f777c32cac gopy: hardcode python2 for now in tests
This CL makes sure we are using python2 for the tests.
Eventually, we'll have to test both.
2017-08-04 18:10:05 +02:00
Sebastien Binet 616ace6c34 gopy,_examples: use py2/py3 compatible syntax where possible
This CL makes sure we are more or less ready for python3.

- import __future__.print_function so python2 can use the same
  print(foo, bar) syntax than python3
- use the python3 syntax for catching exceptions
2017-08-04 18:07:11 +02:00
Dong-hee Na 4eac7b0d9f cffi: Support unnamed types and pass hi.go
* Pass hi.go
* Support unnamed types.
2017-08-04 17:14:22 +02:00
Dong-hee Na c2676d7f14 cffi: Support named type + Pass 'seq.go' test.
* Pass 'named.go' test.
* Support to generate named type includes slice and array types.
* Add doc.go for bind package.
* Add comments.
* Support __iadd__ for Go slice types.
* Add a 'seq.go' test for the CFFI engine.
2017-08-02 15:43:33 +00:00
Emil Lerch 3b8a754b6c bind: add support for symbol removal 2017-07-16 15:19:44 +02:00
Dong-hee Na 4442f0a7cd cffi: Support struct types.
* Generate Struct types from a CFFI engine.
* Passing a Struct type as an argument is supported.
* Passing 'structs.go' test.
2017-07-14 10:38:41 +02:00
Freddie Vargus db612edd21 doc: Fix markdown syntax for license link 2017-07-13 12:50:49 -06:00
Dong-hee Na f5e31a221c cffi: Let Python3 handles string as ASCII. 2017-07-12 11:49:43 +02:00
Dong-hee Na 02e3537b5f cffi: Support complex number types.
* Generating complex64 / complex128 types from a CFFI engine is supported.
* Passing complex types as an argument is supported.
* Create a new test for complex operations.
2017-07-07 08:37:14 +00:00
Dong-hee Na fddd338960 gencffi: Support bool types. 2017-06-27 13:25:11 +00:00
Dong-hee Na f3d235ef40 gopy: go-1.9 requires exactly one main package for c-shared libs
Fix: go-python/gopy#108
2017-06-27 06:54:34 +00:00
Dong-hee Na 9f50369857 gencffi: Detect functions returning a Go error
* Detect functions returning a Go error and make them pythonic (raising an Exception).
* Add tests for it.
Now it only supports 2 return values.
CPy2 and CFFI should support more return values.

Fixes: go-python/gopy#104
2017-06-16 07:31:31 +00:00
Dong-hee Na 2bad8a4b16 bind, gencffi: Remove generating builders and support Vars and Consts.
- Remove the generating builder python script.
- Now, genCFFI interface is same as the genCpy.
- Support builtin-types Vars and Consts.
- Pass empty.go
- Pass cgo.go
- Pass vars.go
- Pass consts.go

Updates: go-python/gopy#102
2017-06-14 09:52:02 +00:00
Dong-hee Na 6456a228f7 gopy, bind: add initial boilerplate code for cffi support
This CL adds the initial infrastructure to support CFFI as a backend for gopy.
It also adds the necessary dependencies for Travis-CI to test CFFI.

Updates go-python/gopy#48
Fixes go-python/gopy#87
2017-06-08 15:56:49 +00:00
Sebastien Binet 7c437e90f3 gopy: add test for gofmt'd code 2017-06-08 14:24:20 +02:00
Sebastien Binet d8d6050a7f bind,_examples: apply goimports 2017-06-08 14:24:00 +02:00
Sebastien Binet 48dcae4630 gopy: enable travis for Go=1.{6,7,8} 2017-05-29 16:30:22 +02:00
Sebastien Binet b62d662fcc gopy: add a CONTRIBUTE guide
Fixes go-python/gopy#90.
2017-05-29 09:57:04 +02:00
Dong-hee Na 633184e998 bind: make sure GODEBUG=cgocheck=0 for Go>=1.6 2017-05-09 15:31:24 +00:00
Sebastien Binet ae2cdaa5cd doc: add link to go-python forum and mailing list 2017-03-06 15:58:12 +01:00
Sebastien Binet 7c5291933a doc: document CGo>=1.6 limitation, provide workaround 2017-03-06 15:44:19 +01:00
Sebastien Binet a4a47725eb doc: document current limitation w/ Go >= 1.6 2016-07-01 14:08:53 +02:00