mirror of
https://github.com/capnproto/pycapnp.git
synced 2025-03-05 17:01:01 +01:00
Merge branch 'release/0.3.1'
This commit is contained in:
commit
0b1080dca2
4 changed files with 28 additions and 6 deletions
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:
|
||||
|
||||
```bash
|
||||
wget https://github.com/kentonv/capnproto/archive/master.zip
|
||||
unzip master.zip
|
||||
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
|
||||
sudo make install
|
||||
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
|
||||
|
||||
|
@ -89,5 +97,16 @@ f = open('example', 'r')
|
|||
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)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ Installation
|
|||
===================
|
||||
|
||||
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::
|
||||
|
||||
|
@ -22,9 +22,12 @@ 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::
|
||||
|
||||
|
||||
pip install -U setuptools
|
||||
pip install capnp
|
||||
|
||||
You only need to run the setuptools line if you have a setuptools older than v0.8.0.
|
||||
|
||||
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.
|
||||
|
||||
Load a Cap'n Proto Schema
|
||||
------------------------
|
||||
-------------------------
|
||||
|
||||
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()
|
||||
|
||||
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`::
|
||||
|
||||
|
@ -157,7 +157,7 @@ Much like before, you will have to de-serialize the message from a file descript
|
|||
message = capnp.PackedFdMessageReader(f.fileno())
|
||||
|
||||
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::
|
||||
|
||||
|
|
2
setup.py
2
setup.py
|
@ -13,7 +13,7 @@ import os
|
|||
|
||||
MAJOR = 0
|
||||
MINOR = 3
|
||||
MICRO = 0
|
||||
MICRO = 1
|
||||
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue