Add custom build backend to support build args (#328)

This implements a custom build backend, inspired by the
[solution used by Pillow.](https://github.com/python-pillow/Pillow/pull/7171)

install-option is deprecated and was removed with pip 23.1. The
comonly accepted solution seems to be to define a custom build
backend for now
https://github.com/pypa/setuptools/issues/2491#issuecomment-1589764230

This commit changes the usage from `--install-option` to `--config-settings`.
This commit is contained in:
Tobias Ahrens
2023-10-03 07:30:51 +02:00
committed by GitHub
parent db26d60283
commit d48ffea939
7 changed files with 77 additions and 50 deletions

View File

@@ -38,25 +38,27 @@ cd pycapnp
pip install .
```
By default, the setup script will automatically use the locally installed Cap'n Proto.
If Cap'n Proto is not installed, it will bundle and build the matching Cap'n Proto library.
To enforce bundling, the Cap'n Proto library:
```bash
pip install . -C force-bundled-libcapnp=True
```
If you wish to install using the latest upstream C++ Cap'n Proto:
```bash
pip install \
--install-option "--libcapnp-url" \
--install-option "https://github.com/capnproto/capnproto/archive/master.tar.gz" \
--install-option "--force-bundled-libcapnp" .
pip install . \
-C force-bundled-libcapnp=True \
-C libcapnp-url="https://github.com/capnproto/capnproto/archive/master.tar.gz"
```
To force bundled python:
To enforce using the installed Cap'n Proto from the system:
```bash
pip install --install-option "--force-bundled-libcapnp" .
```
Slightly more prompt error messages using distutils rather than pip.
```bash
python setup.py install --force-bundled-libcapnp
pip install . -C force-system-libcapnp=True
```
The bundling system isn't that smart so it might be necessary to clean up the bundled build when changing versions:
@@ -92,19 +94,12 @@ pipenv run pytest
### Binary Packages
Building a dumb binary distribution:
Building a Python wheel distributiion
```bash
python setup.py bdist_dumb
pip wheel .
```
Building a Python wheel distributiion:
```bash
python setup.py bdist_wheel
```
## Documentation/Example
There is some basic documentation [here](http://capnproto.github.io/pycapnp/).