8000 refactor go-python to go-python3 · sbinet/go-python@218f603 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 218f603

Browse files
author
William Mosley
committed
refactor go-python to go-python3
1 parent c904ba1 commit 218f603

20 files changed

+33
-33
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ go-python
33

44
[![Build Status](https://drone.io/github.com/sbinet/go-python/status.png)](https://drone.io/github.com/sbinet/go-python/latest)
55

6-
Naive `go` bindings towards the C-API of CPython-2.
6+
Naive `go` bindings towards the C-API of CPython-3.
77

88
this package provides a ``go`` package named "python" under which most of the ``PyXYZ`` functions and macros of the public C-API of CPython have been exposed.
99

@@ -31,13 +31,13 @@ not standardised across distributions and OSes, so you may have to
3131
edit the ``cgoflags.go`` file accordingly.
3232

3333
```sh
34-
$ go get github.com/sbinet/go-python
34+
$ go get github.com/willATgithub/go-python3
3535
```
3636

3737
If ``go get`` + ``pkg-config`` failed:
3838

3939
```sh
40-
$ cd go-python
40+
$ cd go-python3
4141
$ edit cgoflags.go
4242
$ make VERBOSE=1
4343
```
@@ -59,17 +59,17 @@ Example:
5959
package main
6060

6161
import "fmt"
62-
import "github.com/sbinet/go-python"
62+
import "github.com/willATgithub/go-python3"
6363

6464
func init() {
6565
err := python.Initialize()
6666
if err != nil {
6767
panic(err.Error())
68-
}
68+
}
6969
}
7070

7171
func main() {
72-
gostr := "foo"
72+
gostr := "foo"
7373
pystr := python.PyString_FromString(gostr)
7474
str := python.PyString_AsString(pystr)
7575
fmt.Println("hello [", str, "]")
@@ -88,9 +88,9 @@ TODO:
8888

8989
- add CPython unit-tests
9090

91-
- do not expose ``C.FILE`` pointer and replace it with ``os.File`` in "go-python" API
91+
- do not expose ``C.FILE`` pointer and replace it with ``os.File`` in "go-python3" API
9292

93-
- provide an easy way to extend go-python with ``go`` based extensions
93+
- provide an easy way to extend go-python3 with ``go`` based extensions
9494

9595
- think about the need (or not) to translate CPython exceptions into go panic/recover mechanism
9696

capi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package python
22

3-
// #include "go-python.h"
3+
// #include "go-python3.h"
44
import "C"
55

66
// PyObject* Py_BuildValue(const char *format, ...)

cgoflags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package python
22

3-
// #cgo pkg-config: python-2.7
4-
// #include "go-python.h"
3+
// #cgo pkg-config: python-3.7
4+
// #include "go-python3.h"
55
import "C"
66

77
// EOF

dict.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package python
22

3-
//#include "go-python.h"
3+
//#include "go-python3.h"
44
import "C"
55

66
import (

exceptions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package python
22

3-
// #include "go-python.h"
3+
// #include "go-python3.h"
44
import "C"
55

66
import (

exceptions_posix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
package python
44

5-
// #include "go-python.h"
5+
// #include "go-python3.h"
66
import "C"
77

88
// int PySignal_SetWakeupFd(int fd)

file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package python
22

33
/*
44
#include <stdio.h>
5-
#include "go-python.h"
5+
#include "go-python3.h"
66
77
PyObject*
88
_gopy_PyFile_FromFile(int fd, char *name, char *mode) {

heap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package python
22

3-
// #include "go-python.h"
3+
// #include "go-python3.h"
44
import "C"
55

66
import (

init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package python
22

3-
// #include "go-python.h"
3+
// #include "go-python3.h"
44
// char *gopy_ProgName = NULL;
55
// char *gopy_PythonHome = NULL;
66
import "C"

init_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package python_test
33
import (
44
"testing"
55

6-
python "github.com/sbinet/go-python"
6+
python "github.com/willATgithub/go-python3"
77
)
88

99
func TestProgramName(t *testing.T) {
@@ -16,7 +16,7 @@ func TestProgramName(t *testing.T) {
1616
}
1717

1818
func TestPythonHome(t *testing.T) {
19-
const want = "/usr/lib/go-python"
19+
const want = "/usr/lib/go-python3"
2020
python.Py_SetPythonHome(want)
2121
got := python.Py_GetPythonHome()
2222
if got != want {

0 commit comments

Comments
 (0)
0