Merge branch 'release/0.3.1'
This commit is contained in:
19
README.md
19
README.md
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
First you need a system-wide installation of the Capnproto C++ library >= 0.3. Unfortunately, as of now, that means you have to build from the HEAD of Cap'n Proto. Follow these instructions to do so:
|
First you need a system-wide installation of the Capnproto C++ library >= 0.3. Unfortunately, as of now, that means you have to build from the HEAD of Cap'n Proto. Follow these instructions to do so:
|
||||||
|
|
||||||
|
```bash
|
||||||
wget https://github.com/kentonv/capnproto/archive/master.zip
|
wget https://github.com/kentonv/capnproto/archive/master.zip
|
||||||
unzip master.zip
|
unzip master.zip
|
||||||
cd capnproto-master/c++
|
cd capnproto-master/c++
|
||||||
@@ -13,6 +14,13 @@ First you need a system-wide installation of the Capnproto C++ library >= 0.3. U
|
|||||||
make -j6 check
|
make -j6 check
|
||||||
sudo make install
|
sudo make install
|
||||||
sudo ldconfig
|
sudo ldconfig
|
||||||
|
```
|
||||||
|
|
||||||
|
A recent version of setuptools is also required. You can install a newer version with:
|
||||||
|
|
||||||
|
```python
|
||||||
|
pip install -U setuptools
|
||||||
|
```
|
||||||
|
|
||||||
## Building and installation
|
## Building and installation
|
||||||
|
|
||||||
@@ -89,5 +97,16 @@ f = open('example', 'r')
|
|||||||
printAddressBook(f.fileno())
|
printAddressBook(f.fileno())
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Common Problems
|
||||||
|
|
||||||
|
If you get an error on installation like:
|
||||||
|
|
||||||
|
...
|
||||||
|
gcc-4.8: error: capnp/capnp.c: No such file or directory
|
||||||
|
|
||||||
|
gcc-4.8: fatal error: no input files
|
||||||
|
|
||||||
|
Then you have too old a version of setuptools. Run `pip install -U setuptools` then try again.
|
||||||
|
|
||||||
[](https://travis-ci.org/jparyani/capnpc-python-cpp)
|
[](https://travis-ci.org/jparyani/capnpc-python-cpp)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Installation
|
|||||||
===================
|
===================
|
||||||
|
|
||||||
C++ Cap'n Proto Library
|
C++ Cap'n Proto Library
|
||||||
---------------------
|
------------------------
|
||||||
|
|
||||||
You need to install the C++ Cap'n Proto library first. It requires a C++ compiler with C++11 support, such as GCC 4.7+ or Clang 3.2+. Follow installation docs at `http://kentonv.github.io/capnproto/install.html <http://kentonv.github.io/capnproto/install.html>`_ with an added `sudo ldconfig` after you're done installing, or if you're feeling lazy, you can run the commands below::
|
You need to install the C++ Cap'n Proto library first. It requires a C++ compiler with C++11 support, such as GCC 4.7+ or Clang 3.2+. Follow installation docs at `http://kentonv.github.io/capnproto/install.html <http://kentonv.github.io/capnproto/install.html>`_ with an added `sudo ldconfig` after you're done installing, or if you're feeling lazy, you can run the commands below::
|
||||||
|
|
||||||
@@ -23,8 +23,11 @@ Pip
|
|||||||
|
|
||||||
Using pip is by far the easiest way to install the library. After you've installed the C++ library, all you need to run is::
|
Using pip is by far the easiest way to install the library. After you've installed the C++ library, all you need to run is::
|
||||||
|
|
||||||
|
pip install -U setuptools
|
||||||
pip install capnp
|
pip install capnp
|
||||||
|
|
||||||
|
You only need to run the setuptools line if you have a setuptools older than v0.8.0.
|
||||||
|
|
||||||
From Source
|
From Source
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ This assumes you already have the capnp library installed. If you don't, please
|
|||||||
In general, this library is a very light wrapping of the `Cap'n Proto C++ library <http://kentonv.github.io/capnproto/cxx.html>`_. You can refer to its docs for more advanced concepts, or just to get a basic idea of how the python library is structured.
|
In general, this library is a very light wrapping of the `Cap'n Proto C++ library <http://kentonv.github.io/capnproto/cxx.html>`_. You can refer to its docs for more advanced concepts, or just to get a basic idea of how the python library is structured.
|
||||||
|
|
||||||
Load a Cap'n Proto Schema
|
Load a Cap'n Proto Schema
|
||||||
------------------------
|
-------------------------
|
||||||
|
|
||||||
First you need to import the library::
|
First you need to import the library::
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ First you need to allocate a MessageBuilder for your message to go in. There is
|
|||||||
message = capnp.MallocMessageBuilder()
|
message = capnp.MallocMessageBuilder()
|
||||||
|
|
||||||
Initialize a New Cap'n Proto Object
|
Initialize a New Cap'n Proto Object
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Now that you have a message buffer, you need to allocate an actual object that is from your schema. In this case, we will allocate an `AddressBook`::
|
Now that you have a message buffer, you need to allocate an actual object that is from your schema. In this case, we will allocate an `AddressBook`::
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ Much like before, you will have to de-serialize the message from a file descript
|
|||||||
message = capnp.PackedFdMessageReader(f.fileno())
|
message = capnp.PackedFdMessageReader(f.fileno())
|
||||||
|
|
||||||
Initialize a New Cap'n Proto Object
|
Initialize a New Cap'n Proto Object
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Just like when building, you have to actually specify which message you want to read out of buffer::
|
Just like when building, you have to actually specify which message you want to read out of buffer::
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user