<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/cffi.git/cffi/pkgconfig.py, branch python3.11.0b4</title>
<subtitle>foss.heptapod.net: pypy/cffi
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/cffi.git/'/>
<entry>
<title>Tweaks to the pkgconfig support</title>
<updated>2019-01-31T11:14:50+00:00</updated>
<author>
<name>Armin Rigo</name>
<email>arigo@tunes.org</email>
</author>
<published>2019-01-31T11:14:50+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/cffi.git/commit/?id=acfd2aef58cd40f4ee06bcc551b8549bb16974e8'/>
<id>acfd2aef58cd40f4ee06bcc551b8549bb16974e8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Reduce number of exceptions</title>
<updated>2019-01-11T21:38:58+00:00</updated>
<author>
<name>Michal Vyskocil</name>
<email>michal.vyskocil@gmail.com</email>
</author>
<published>2019-01-11T21:38:58+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/cffi.git/commit/?id=53466767c1c37d79ca28a4e83100759f599c2d43'/>
<id>53466767c1c37d79ca28a4e83100759f599c2d43</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>P: cffi must be compatible with 3.2</title>
<updated>2019-01-10T12:30:09+00:00</updated>
<author>
<name>Michal Vyskocil</name>
<email>michal.vyskocil@gmail.com</email>
</author>
<published>2019-01-10T12:30:09+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/cffi.git/commit/?id=32ab869ab54d5ac6da50ce7c159e17789fe43d1c'/>
<id>32ab869ab54d5ac6da50ce7c159e17789fe43d1c</id>
<content type='text'>
S: can't use u prefixes, as it is syntax error there
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
S: can't use u prefixes, as it is syntax error there
</pre>
</div>
</content>
</entry>
<entry>
<title>Define and raise specific hierarchy of exceptions</title>
<updated>2019-01-10T12:28:54+00:00</updated>
<author>
<name>Michal Vyskocil</name>
<email>michal.vyskocil@gmail.com</email>
</author>
<published>2019-01-10T12:28:54+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/cffi.git/commit/?id=8c32e1dc8d053ce26153e47ee273188d70606939'/>
<id>8c32e1dc8d053ce26153e47ee273188d70606939</id>
<content type='text'>
* PkgConfigNotFound             - not installed
* PkgConfigError                - base pkg-config errors
    * PkgConfigModuleNotFound   - pc file for module was not found
    * PkgConfigModuleVersionNotFound - requested version was not found

Boilerplate now looks
```
from cffi.error import PkgConfigNotFound, PkgConfigError
...
try:
    # try pkg-config way
    ffibuilder.set_source(..., pkgconfig=["libczmq &gt;= 4.0.0"])
except PkgConfigNotFound as e:
    # if pkg-config is not installed, try backup
    ffibuilder.set_source(..., libraries=["czmq", "zmq", "uuid", "pgm"])
except PkgConfigError as e:
    # here we catch both PkgConfigModuleNotFound and PkgConfigModuleVersionNotFound
    # and raise it again - simply to show they are raised
    raise e from None
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* PkgConfigNotFound             - not installed
* PkgConfigError                - base pkg-config errors
    * PkgConfigModuleNotFound   - pc file for module was not found
    * PkgConfigModuleVersionNotFound - requested version was not found

Boilerplate now looks
```
from cffi.error import PkgConfigNotFound, PkgConfigError
...
try:
    # try pkg-config way
    ffibuilder.set_source(..., pkgconfig=["libczmq &gt;= 4.0.0"])
except PkgConfigNotFound as e:
    # if pkg-config is not installed, try backup
    ffibuilder.set_source(..., libraries=["czmq", "zmq", "uuid", "pgm"])
except PkgConfigError as e:
    # here we catch both PkgConfigModuleNotFound and PkgConfigModuleVersionNotFound
    # and raise it again - simply to show they are raised
    raise e from None
```
</pre>
</div>
</content>
</entry>
<entry>
<title>Document version pinning for pkgconfig</title>
<updated>2019-01-09T07:46:01+00:00</updated>
<author>
<name>Michal Vyskocil</name>
<email>michal.vyskocil@gmail.com</email>
</author>
<published>2019-01-09T07:46:01+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/cffi.git/commit/?id=91b62e4853e40961dc07f67b87222e0780fd5031'/>
<id>91b62e4853e40961dc07f67b87222e0780fd5031</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Exception based flow</title>
<updated>2019-01-09T07:39:32+00:00</updated>
<author>
<name>Michal Vyskocil</name>
<email>michal.vyskocil@gmail.com</email>
</author>
<published>2019-01-09T07:39:32+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/cffi.git/commit/?id=a8b836b1f1c2b6505636a2e136894528eab04dc5'/>
<id>a8b836b1f1c2b6505636a2e136894528eab04dc5</id>
<content type='text'>
Now the with non pkg-config backup would be
```
module_name = "_czmq"
source = "#include &lt;czmq.h&gt;"
try:
    print(f"### pkg-config path")
    ffibuilder.set_source(
        module_name,
        source,
        pkgconfig=["libczmq"]
    )
except Exception as e:
    print(f"Exception e: {e}")
    ffibuilder.set_source(
        module_name,
        source,
        libraries=["czmq"]
    )
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now the with non pkg-config backup would be
```
module_name = "_czmq"
source = "#include &lt;czmq.h&gt;"
try:
    print(f"### pkg-config path")
    ffibuilder.set_source(
        module_name,
        source,
        pkgconfig=["libczmq"]
    )
except Exception as e:
    print(f"Exception e: {e}")
    ffibuilder.set_source(
        module_name,
        source,
        libraries=["czmq"]
    )
```
</pre>
</div>
</content>
</entry>
<entry>
<title>fix encoding of `--libs-only-l` it's about file system names</title>
<updated>2019-01-08T18:58:02+00:00</updated>
<author>
<name>Michal Vyskocil</name>
<email>michal.vyskocil@gmail.com</email>
</author>
<published>2019-01-08T18:58:02+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/cffi.git/commit/?id=bded8477d9d53cca93f0f2f740c9a2e05ac09ee5'/>
<id>bded8477d9d53cca93f0f2f740c9a2e05ac09ee5</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Real test of a pkgconfig integration</title>
<updated>2019-01-08T10:08:02+00:00</updated>
<author>
<name>Michal Vyskocil</name>
<email>michal.vyskocil@gmail.com</email>
</author>
<published>2019-01-08T10:08:02+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/cffi.git/commit/?id=3ea5d9a89d5288047026ebbb10c5b7f938ca2caf'/>
<id>3ea5d9a89d5288047026ebbb10c5b7f938ca2caf</id>
<content type='text'>
Fix encoding errors

Given testing Python program
```
from cffi import FFI
ffibuilder = FFI()

ffibuilder.cdef(
    "char* zsys_hostname();"
)

ffibuilder.set_source(
    "_czmq",
    "#include &lt;czmq.h&gt;",
    pkgconfig=["libczmq"]
)


if __name__ == "__main__":
    ffibuilder.compile(verbose=True)
```

We can run ffibuilder from source dir of czmq

```
PKG_CONFIG_PATH=`pwd`/src python3 t.py
generating ./_czmq.c
...
gcc -pthread -shared -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none ./_czmq.o -L/usr/local/lib64 -L/usr/lib64 -lczmq -lzmq -lpython3.6m -o ./_czmq.cpython-36m-x86_64-linux-gnu.so
```

```
python3 t.py
generating ./_czmq.c
...
gcc -pthread -shared -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none ./_czmq.o -L/usr/lib64 -lczmq -lpython3.6m -o ./_czmq.cpython-36m-x86_64-linux-gnu.so
```

Note that in the first case `/usr/local` has been added to the compiler path as
provided by local pkg-config file.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix encoding errors

Given testing Python program
```
from cffi import FFI
ffibuilder = FFI()

ffibuilder.cdef(
    "char* zsys_hostname();"
)

ffibuilder.set_source(
    "_czmq",
    "#include &lt;czmq.h&gt;",
    pkgconfig=["libczmq"]
)


if __name__ == "__main__":
    ffibuilder.compile(verbose=True)
```

We can run ffibuilder from source dir of czmq

```
PKG_CONFIG_PATH=`pwd`/src python3 t.py
generating ./_czmq.c
...
gcc -pthread -shared -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none ./_czmq.o -L/usr/local/lib64 -L/usr/lib64 -lczmq -lzmq -lpython3.6m -o ./_czmq.cpython-36m-x86_64-linux-gnu.so
```

```
python3 t.py
generating ./_czmq.c
...
gcc -pthread -shared -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none ./_czmq.o -L/usr/lib64 -lczmq -lpython3.6m -o ./_czmq.cpython-36m-x86_64-linux-gnu.so
```

Note that in the first case `/usr/local` has been added to the compiler path as
provided by local pkg-config file.
</pre>
</div>
</content>
</entry>
<entry>
<title>Increase testing coverage and refactor method names</title>
<updated>2019-01-08T07:32:16+00:00</updated>
<author>
<name>Michal Vyskocil</name>
<email>michal.vyskocil@gmail.com</email>
</author>
<published>2019-01-08T07:32:16+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/cffi.git/commit/?id=a074df4d40f178c21249bc3f0791082f6230499f'/>
<id>a074df4d40f178c21249bc3f0791082f6230499f</id>
<content type='text'>
Making `pkgconfig.call` function accessible, tests can monkey patch it and
provide mock. This improves testing, however raised a need to give
functions better names than `pkgconfig.pkgconfig_kwargs` or `pkgconfig.pc`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Making `pkgconfig.call` function accessible, tests can monkey patch it and
provide mock. This improves testing, however raised a need to give
functions better names than `pkgconfig.pkgconfig_kwargs` or `pkgconfig.pc`.
</pre>
</div>
</content>
</entry>
<entry>
<title>code not compatible with python3</title>
<updated>2017-05-25T08:02:18+00:00</updated>
<author>
<name>Michal Vyskocil</name>
<email>michal.vyskocil@gmail.com</email>
</author>
<published>2017-05-25T08:02:18+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/cffi.git/commit/?id=fed468bcee7be3ce005321cbcd97fd1d1a64b567'/>
<id>fed468bcee7be3ce005321cbcd97fd1d1a64b567</id>
<content type='text'>
use bytes instead of strings
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
use bytes instead of strings
</pre>
</div>
</content>
</entry>
</feed>
