Skip to content

Commit

Permalink
Binary wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
gvalkov committed May 8, 2024
1 parent 81ac5bb commit 396bf0c
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 8 deletions.
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
develop-eggs/
dist/
build/
wheelhouse/
dropin.cache
pip-log.txt
.installed.cfg
.coverage
tags
TAGS
evdev/*.so
evdev/ecodes.c
evdev/iprops.c
docs/_build
.#*
__pycache__
.pytest_cache

evdev/*.so
evdev/ecodes.c
evdev/iprops.c
docs/_build
evdev/_ecodes.py
evdev/_input.py
evdev/_uinput.py
7 changes: 7 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
---------

1.8.0 (Unreleased)
==================

- Binary wheels are now provided by the `evdev-binary http://pypi.python.org/pypi/evdev-binary`_ package.
The package is compiled on manylinux_2_28 against kernel 4.18.


1.7.1 (May 8, 2024)
====================

Expand Down
23 changes: 19 additions & 4 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ pip_, preferably in a [virtualenv]_:
Specifying header locations
===========================
---------------------------

By default, the setup script will look for the ``input.h`` and
``input-event-codes.h`` [#f1]_ header files ``/usr/include/linux``.

You may use the ``--evdev-headers`` option to the ``build_ext`` setuptools
command to the location of these header files. It accepts one or more
command to the location of these header files. It accepts one or more
colon-separated paths. For example:

.. code-block:: bash
Expand All @@ -74,12 +74,27 @@ colon-separated paths. For example:
--include-dirs buildroot/ \
install # or any other command (e.g. develop, bdist, bdist_wheel)
.. [#f1] ``input-event-codes.h`` is found only in more recent kernel versions.
From a binary package
=====================

You may choose to install a precompiled version of *python-evdev* from pypi. The
`evdev-binary`_ package provides binary wheels that have been compiled on EL8
against the 4.18.0 kernel headers.

.. code-block:: bash
$ python3 -m pip install evdev-binary
While the evdev interface is stable, the precompiled version may not be fully
compatible or expose all the features of your running kernel. For best results,
it is recommended to use an OS package or to install from source.


.. [#f1] ``input-event-codes.h`` is found only in recent kernel versions.
.. _pypi: http://pypi.python.org/pypi/evdev
.. _evdev-binary: http://pypi.python.org/pypi/evdev-binary
.. _github: https://github.com/gvalkov/python-evdev
.. _pip: http://pip.readthedocs.org/en/latest/installing.html
.. _example: https://github.com/gvalkov/python-evdev/tree/master/examples
.. _`async/await`: https://docs.python.org/3/library/asyncio-task.html
.. _virtualenv: https://docs.python.org/3/library/venv.html
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ ruff
bump-my-version ~= 0.17.4
build
twine
cibuildwheel
15 changes: 15 additions & 0 deletions scripts/build-binary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -o allexport
set -o nounset

CIBW_MANYLINUX_X86_64_IMAGE="manylinux_2_28"
CIBW_MANYLINUX_I686_IMAGE="manylinux_2_28"
CIBW_CONTAINER_ENGINE="podman"
CIBW_SKIP="cp36-*"
CIBW_ARCHS_LINUX="auto64"
CIBW_BEFORE_ALL_LINUX=./scripts/cibw-before.sh
CIBW_TEST_COMMAND="python -c 'import evdev; print(evdev)'"
CIBW_ENVIRONMENT="PACKAGE_NAME=evdev-binary"

exec cibuildwheel
6 changes: 6 additions & 0 deletions scripts/cibw-before.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash


if [ -n "$PACKAGE_NAME" ]; then
sed -i -re 's,^(name = ")evdev("),\1'${PACKAGE_NAME}'\2,' pyproject.toml
fi
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def create_ecodes(headers=None):
build_ecodes --evdev-headers path/input.h:path/input-event-codes.h \\
build_ext --include-dirs path/ \\
install
If you prefer to avoid building this package from source, then please consider
installing the `evdev-binary` package instead. Keep in mind that it may not be
fully compatible with, or support all the features of your current kernel.
"""

sys.stderr.write(textwrap.dedent(msg))
Expand Down

0 comments on commit 396bf0c

Please sign in to comment.