<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/cffi.git/testing/cffi1/test_pkgconfig.py, branch py.test</title>
<subtitle>foss.heptapod.net: pypy/cffi
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cffi.git/'/>
<entry>
<title>Replace py.test usage with pytest, explicitly require py for tests</title>
<updated>2022-11-11T13:51:14+00:00</updated>
<author>
<name>Miro Hrončok</name>
<email>miro@hroncok.cz</email>
</author>
<published>2022-11-11T13:51:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cffi.git/commit/?id=babc98d98570b5dbb85fb1c58b012aafa9769696'/>
<id>babc98d98570b5dbb85fb1c58b012aafa9769696</id>
<content type='text'>
pytest 7.2+ no longer depends on py. It ships py.path and py.error only.
See https://docs.pytest.org/en/7.2.x/changelog.html#deprecations

The tests use py.code as well, hence we declare and document a test dependency on py.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
pytest 7.2+ no longer depends on py. It ships py.path and py.error only.
See https://docs.pytest.org/en/7.2.x/changelog.html#deprecations

The tests use py.code as well, hence we declare and document a test dependency on py.
</pre>
</div>
</content>
</entry>
<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://git.baserock.org/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>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://git.baserock.org/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>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://git.baserock.org/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://git.baserock.org/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://git.baserock.org/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>
<entry>
<title>add test for pkg-config integration</title>
<updated>2017-05-25T08:00:25+00:00</updated>
<author>
<name>Michal Vyskocil</name>
<email>michal.vyskocil@gmail.com</email>
</author>
<published>2017-05-25T08:00:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/cffi.git/commit/?id=094ebd4afb3cae6f9d404fe8d295ecfd8e5600de'/>
<id>094ebd4afb3cae6f9d404fe8d295ecfd8e5600de</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
