1
0
mirror of https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git synced 2026-10-25 12:39:18 +03:00
Commit Graph

189 Commits

Author SHA1 Message Date
Bartosz Golaszewski
7450b2a365 bindings: python: gpiod v2.2.3
Small bugfix release.

Changelog:
- remove unused import from chip.py
- fix potential crash due to invalid usage of PyDict_Next()

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-12-20 17:50:52 +01:00
George Harker
b91fd36941 bindings: python: fix potential PyDict_Next() crash
PyDict_Next() does not guarantee pos is contiguous, and pypy increments
it past the end of the dict size. Fix reliance on pos for constructing
args for libgpiod call.

Fixes: b7ba732e6a ("treewide: libgpiod v2 implementation")
Signed-off-by: George Harker <george@george-graphics.co.uk>
Link: https://lore.kernel.org/r/20241202171302.51437-1-george@george-graphics.co.uk
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-12-02 20:48:54 +01:00
Bartosz Golaszewski
a93a67648b bindings: python: chip: remove unused import
We no longer use the select module directly in chip.py so drop the
unneeded import.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-11-13 12:30:31 +01:00
Bartosz Golaszewski
2371df4671 bindings: python: gpiod v2.2.2
Minor gpiod package release.

Changelog:
- fix Chip.request_lines() typing
- improve the output of LineSettings.__repr__()
- import gpiod attributes in external module
- specify a tar extract filter for python >= 3.12

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-11-12 15:17:56 +01:00
Vincent Fazio
b89a90aaed bindings: python: specify a tar extract filter
Starting in Python 3.12, extracting files from tarballs without a filter
specified generates a DeprecationWarning [0].

For Python >= 3.12, specify the `fully_trusted_filter` filter which
replicates the behavior from previous versions.

This filter also makes sense as we should be able to trust the tarball
the maintainers generate after the hash has been verified.

[0]: https://docs.python.org/3/library/tarfile.html#tarfile-extraction-filter

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://lore.kernel.org/r/20241107205001.574426-1-vfazio@xes-inc.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-11-12 14:01:04 +01:00
Vincent Fazio
9e2795b90b bindings: python: import gpiod attributes in external module
Previously, the external module relied on gpiod attributes being present
within `globals()` to construct return values back to the caller.

This assumption required callers of the external module to have imported
the attributes to populate `globals()` for the interface to work.

Having this implicit contract is opaque and prone to causing issues if
imports within gpiod modules ever get reworked.

Now, the external module explicitly imports attributes from gpiod in
order to return values back to the caller.

There should be no concern about circular imports as the external module
should be completely imported by the time callers call into it.

Since Py_gpiod_GetGlobalType is no longer used, it has been replaced
with Py_gpiod_GetModuleAttrString which returns a new PyObject*
reference for the named module and attribute that must be decremented
when no longer in use.

Closes: https://github.com/brgl/libgpiod/issues/101
Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://lore.kernel.org/r/20241008175139.1198980-1-vfazio@xes-inc.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-10-14 16:44:59 +02:00
Bartosz Golaszewski
f496cb942e bindings: python: improve LineSettings.__repr__()
Currently, for the output of LineSettings.__repr__() to be eval()able,
the user must have pulled all the relevant definitions from gpiod.line
within the scope where it is used. Modify the output so that all the user
needs is `import gpiod`.

Reported-by: Vincent Fazio <vfazio@gmail.com>
Link: https://lore.kernel.org/r/20240920143203.6377-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-27 10:14:04 +02:00
Vincent Fazio
c249c05a84 bindings: python: fix Chip.request_lines() typing
The output_values argument was typed as a dict of tuples, however, the
code expects a dict of int|str.

Fixes: 27a69b0bfd ("bindings: python: add the output_values argument to Chip.request_lines()")
Closes: https://github.com/brgl/libgpiod/issues/96
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Link: https://lore.kernel.org/r/20240914183352.16090-1-vfazio@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-16 08:54:17 +02:00
Bartosz Golaszewski
e8e38dc67d bindings: python: gpiod v2.2.1
Minor gpiod package release.

Changelog:
- fix requesting lines by name with multiple entries
- fix a use-after-free bug in python bindings
- fix passing the event clock property to line requests in python bindings

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-01 14:32:54 +02:00
Benjamin Cabé
c3be23d6d1 bindings: python: properly pass event clock settings
Python binding was ignoring event_clock line setting.

Signed-off-by: Benjamin Cabé <kartben@gmail.com>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240731104658.93117-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-01 10:33:50 +02:00
Iker Pedrosa
cdda65e3d7 bindings: python: fix a use-after-free bug
`req_cfg` variable is freed and then used, which would generate an
error. Avoid this problem by freeing when the variable will no longer be
used.

Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/3d8b12dd60eec59d4184c0bcc7d575b4eccbc22c.1722250385.git.ikerpedrosam@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-01 10:33:44 +02:00
Chuang Zhu
a1617c2f61 bindings: python: fix line request by name with multiple entries
When multiple entries are requested using line names in
Chip.request_lines(), only the the last entry is added to
LineRequest._name_map, causing a ValueError when trying to use functions
like LineRequest.set_value() on any former entries.

Move the required variables to the correct scope.

Signed-off-by: Chuang Zhu <git@chuang.cz>
[Bartosz: tweak the commit message]
Co-developed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240710125719.33655-2-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-01 10:33:35 +02:00
Bartosz Golaszewski
db68634b73 bindings: python: gpiod v2.2.0
Minor gpiod package release.

Changelog:
- add a script for generating sdist and wheels
- fix make build
- support casting of line.Value to bool
- test fixes
- fix __repr__() implementations

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-06-18 22:23:31 +02:00
Vincent Fazio
72d2fa01a2 bindings: python: add script to generate sdist and wheels
Introduce a shell script that generates an sdist tarball and PEP 600/656
conformant wheels.

The wheels are generated via cibuildwheel, a tool provided by the Python
Packaging Authority (PyPA) [0]. The tool leverages toolchains within
containers maintained by PyPA [1] to generate wheels that are runnable
on hosts that meet the platform compatibility tag [2] requirements.

By default, the script creates X86_64 and AArch64 CPython 3.9-3.12
wheels for glibc and musl libc based systems.

These defaults can be overridden via CIBW_* environment variables [3].

[0]: https://cibuildwheel.pypa.io/en/stable/
[1]: https://github.com/pypa/manylinux/
[2]: https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/
[3]: https://cibuildwheel.pypa.io/en/stable/options/#options-summary

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Link: https://lore.kernel.org/r/20240611205041.1448276-1-vfazio@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-06-12 20:15:21 +02:00
Kent Gibson
dee10f0807 bindings: python: fix python-tests-run make target
The python-tests-run target is broken as it does not correctly split
lines.  It also calls Python directly rather then through the $PYTHON
variable.

Fix the line splitting and call Python using the $PYTHON variable.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240526113234.253859-3-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-05-28 11:13:15 +02:00
Kent Gibson
8635780c1c bindings: python: add Testing section to README
Add a section describing how to run the test suite.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240526113234.253859-2-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-05-28 11:13:15 +02:00
Bartosz Golaszewski
27fe10150f bindings: python: tests: run the Value cast test with the rest of the suite
Make the new test file for line definitions part of the entire test-suite
for python bindings.

Fixes: c8e3ae0499 ("bindings: python: tests: add test for casting line.Value to bool")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-05-23 10:08:31 +02:00
Kent Gibson
c8e3ae0499 bindings: python: tests: add test for casting line.Value to bool
The line.Value represents the logical line state, so intuitively you
would expect it to be able to be cast to bool, with ACTIVE
corresponding to True, and INACTIVE to False.

Add a test that line.Value can be cast to bool.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240522004643.96863-2-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-05-23 09:51:53 +02:00
Kent Gibson
5f9152b0ca bindings: python: support casting line.Value to bool
Python types default to being truthy when cast to bool, so casting
line.Value to bool always returns True.

Add a line.Value.__bool__() operator to map the line value to bool as
one would intuitively expect, so ACTIVE is True and INACTIVE is False.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240522004643.96863-3-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-05-23 09:51:53 +02:00
Bartosz Golaszewski
3ece522b8d bindings: python: tests: fix invalid syntax warnings
Use double '/' for escaping regex special characters for patterns in
python strings to silence the following warnings:

bindings/python/tests/tests_edge_event.py:211: SyntaxWarning: invalid escape sequence '\.'
  "<EdgeEvent type=Type\.RISING_EDGE timestamp_ns=[0-9]+ line_offset=0 global_seqno=1 line_seqno=1>",
bindings/python/tests/tests_info_event.py:188: SyntaxWarning: invalid escape sequence '\.'
  '<InfoEvent type=Type\.LINE_REQUESTED timestamp_ns=[0-9]+ line_info=<LineInfo offset=0 name="None" used=True consumer="\?" direction=Direction\.INPUT active_low=False bias=Bias\.UNKNOWN drive=Drive\.PUSH_PULL edge_detection=Edge\.NONE event_clock=Clock\.MONOTONIC debounced=False debounce_period=0:00:00>>',

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-05-22 20:07:34 +02:00
Bartosz Golaszewski
6d5d8afc9c bindings: python: fix __repr__() implementations
The __repr__() function should - if possible - return a valid Python
expression that can be used to instantiate a new object when evaluated.

LineSettings.__repr__() is missing comas between arguments. Both Chip and
LineSettings also don't prefix the returned string with 'gpiod.'. Fix
both functions and add more test cases - including actually using the
strings returned by __repr__() to create new objects and compare their
contents.

Reported-by: Robert Thomas <rob.thomas@raspberrypi.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-02-05 09:49:10 +01:00
Bartosz Golaszewski
40adfc1eb6 bindings: python: fix package installation with Makefile build
The modules are installed in the .egg directory, and therefore cannot be
imported after that. Additionally PIP tries to remove the global gpiod
module if it's not invoked with the --ignore-installed option.

Specify correct --root and fix the --prefix switch.

Link: https://github.com/pypa/pip/issues/3063
Suggested-by: Maxim Devaev <mdevaev@gmail.com>
Reported-by: Maxim Devaev <mdevaev@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-01-09 20:09:37 +01:00
Bartosz Golaszewski
665f360a26 bindings: python: gpiod v2.1.3
Another small bugfix release addressing an issue with building tests.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-11-09 21:26:53 +01:00
Bartosz Golaszewski
ab8662e50e bindings: python: add build_tests.py to the manifest
build_tests.py is not part of the sdist so tests cannot be built from
pypi releases. Add it to MANIFEST.in.

Fixes: d588a6a592 ("bindings: python: standalone build tooling for tests")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-11-09 21:22:07 +01:00
Bartosz Golaszewski
3a0f6a0dd3 bindings: python: gpiod v2.1.2
This is a small bugfix release improving how the C extensions for python
bindings tests are built.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-11-09 21:15:10 +01:00
Phil Howard
d588a6a592 bindings: python: standalone build tooling for tests
Move extension definitions and tooling for building tests into
`build_tests.py` and update Makefile.am to call it with appropriate path
prefixes.

`build_tests.py` will perform a standalone build of the text extensions,
keeping any build noise in a temporary directory and copying the final
built modules automatically out to `tests/gpiosim` and `tests/procname`.

Add "python-tests-run" to Makefile.am so it's clear how to run the tests.

Add .so object files generated by build_test.py to Makefile.am's
clean-local.

Signed-off-by: Phil Howard <phil@gadgetoid.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-11-08 20:50:02 +01:00
Bartosz Golaszewski
8c8547bfdd bindings: python: gpiod v2.1.1
This is a small bugfix release of the python bindings fixing how the
homepage on pypi is displayed.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-11-03 20:31:23 +01:00
Phil Howard
a98a0ff3d5 bindings: python: fix README.md SPDX license tags
Replace the # (which is a markdown heading) with HTML tags to hide SPDX
identifier tags within the project description on pypi.

Signed-off-by: Phil Howard <phil@gadgetoid.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-11-03 20:30:56 +01:00
Bartosz Golaszewski
b9cf47accb bindings: python: gpiod v2.1.0
Release libgpiod python bindings v2.1.0.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-11-03 19:34:25 +01:00
Bartosz Golaszewski
f054a7099d tests: fix version parsing (again)
This time we missed the fact that the last part is optional. Fix it
treewide.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-11-03 17:17:34 +01:00
Bartosz Golaszewski
16a35cc268 bindings: python: fix EXTRA_DIST for examples
One of the example scripts is named differently than what the Makefile
lists it as. Change the EXTRA_DIST variable to fix it.

Fixes: 96c52d3e59 ("bindings: python: examples: replace tools examples with use case examples")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-11-03 11:53:11 +01:00
Phil Howard
0e81b62c01 bindings: python: optionally include module in sdist
Optionally vendor libgpiod source into sdist so that the Python module can
be built from source, even with a missing or mismatched system libgpiod.

Add two new environment variables "LINK_SYSTEM_LIBGPIOD" and
"LIBGPIOD_VERSION" to control what kind of package setup.py will build.

In order to build an sdist or wheel package with a vendored libgpiod a
version must be specified via the "LIBGPIOD_VERSION" environment variable.

This will instruct setup.py to verify the given version against the list
in sha256sums.asc and ensure it meets or exceeds a LIBGPIOD_MINIMUM_VERSION
required for compatibility with the bindings.

It will then fetch the tarball matching the requested version from
mirrors.edge.kernel.org, verify the sha256 signature, unpack it, and copy
the lib and include directories into the package root so they can be
included in sdist or used to build a binary wheel.

eg: LIBGPIOD_VERSION=2.1.0 python3 setup.py sdist

Will build a source distribution with gpiod version 2.1.0 source included.

It will also save the gpiod version into "libgpiod-version.txt" so that it
can be passed to the build when the sdist is built by pip.

Requiring an explicit version ensures that the Python bindings - which
can be changed and versions independent of libgpiod - are built against a
stable libgpiod release.

In order to force a package with vendored gpiod source to link the system
libgpiod, the "LINK_SYSTEM_LIBGPIOD" environment variable can be used:

eg: LINK_SYSTEM_LIBGPIOD=1 pip install libgpiod

Signed-off-by: Phil Howard <phil@gadgetoid.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-11-03 11:36:28 +01:00
Phil Howard
389a966d4e bindings: python: move long_description into README.md
Move the long_description into README.md and include some basic
information about libgpiod, and some simple Python example code.

Signed-off-by: Phil Howard <phil@gadgetoid.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-10-24 11:06:12 +02:00
Bartosz Golaszewski
1a15d301b9 bindings: python: change the package name to 'gpiod'
We now control the name 'gpiod' on pypi. Let's change the project name
as the package we import in python code is named 'gpiod' and not
'libgpiod'

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-10-24 10:20:21 +02:00
Bartosz Golaszewski
05658dc1bc bindings: python: fix the distutils import
The presence of _distutils in setuptools is an implementation detail. If
we want anything from the distutils package, we should import it directly.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-10-24 10:16:50 +02:00
Phil Howard
9f9671dbb6 bindings: python: simplify environ access
Use environ.get() in lieu of an explicit check for GPIOD_WITH_TESTS in
os.environ.

Returns None and evaluates as False if GPIOD_WITH_TESTS == "1" is
not specified.

Signed-off-by: Phil Howard <phil@gadgetoid.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-10-13 10:36:31 +02:00
Phil Howard
85089d0e40 bindings: python: add pyproject.toml, pep 518
Add pyproject.toml to prevent spurious deprecation warnings from pip.

Signed-off-by: Phil Howard <phil@gadgetoid.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-10-13 10:35:01 +02:00
Phil Howard
07a3265715 bindings: python: require python 3.9.0
Required minimum version for PyModule_AddType helper.

Signed-off-by: Phil Howard <phil@gadgetoid.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-10-12 21:07:11 +02:00
Bartosz Golaszewski
b436d05809 bindings: python: replace PyModule_AddObjectRef() with PyModule_AddObject()
PyModule_AddObjectRef() was added in cpython v3.10 while libgpiod claims
to depend on python v3.9. Replace it with an older variant that steals the
reference to the added object on success.

Reported-by: Phil Howard <phil@gadgetoid.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-10-11 10:02:09 +02:00
Bartosz Golaszewski
ced90e7921 bindings: python: tests: don't use the same chip from different threads
There are no thread-safety guarantees in libgpiod. Let's not reuse the
chip object created in one thread to generate info events in another but
use a global request function instead.

Reported-by: Erik Schilling <erik.schilling@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Erik Schilling <erik.schilling@linaro.org>
2023-09-25 09:00:11 +02:00
Bartosz Golaszewski
eb9816ebe0 bindings: python: provide the chip_name property in line_request
Provide a wrapper around gpiod_line_request_get_chip_name() for Python
bindings and update the tests.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-07-21 20:33:39 +02:00
Kent Gibson
96c52d3e59 bindings: python: examples: replace tools examples with use case examples
Replace tool examples with use case examples drawn from the tools.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-26 12:09:10 +02:00
Kent Gibson
36a2127e58 bindings: python: examples: consistency cleanup
A collection of minor changes to be more consistent with other examples:
 - capitalize comments
 - add line offset to value outputs
 - drop comma from edge event outputs
 - improve behaviour if run on a platform that does not match the
   example configuration
 - use with to cleanup request in toggle_line_value.py

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-23 20:56:42 +02:00
Bartosz Golaszewski
d0e098838c bindings: python: package new examples in the distro tarball
Add new example scripts to EXTRA_DIST in the Makefile so that they end up
being shipped with the rest of the code.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-15 10:43:31 +02:00
Kent Gibson
953dbd6af7 bindings: python: examples: add dedicated examples
Add python equivalents of the core examples.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-14 15:02:07 +02:00
Bartosz Golaszewski
3fad9c3662 bindings: python: examples: gpioset: drop redundant []
dict() accepts an iterable, so the [] brackets are redundant.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-12 17:55:29 +02:00
Kent Gibson
e13ac9764a bindings: python: examples: fix potential glitch in gpioset.py
gpioset.py requests lines without setting their output value, and so
sets them all inactive, and subsequently sets them to their requested
value. This can result in glitches on lines which were active and
are set active.

As this is example code, it is also important to demonstrate that the
output value can be set by the request itself.

Request the lines with the correct output values set in the request
itself.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-06-12 16:29:22 +02:00
Bartosz Golaszewski
4687bcc4f4 bindings: python: specify the symbols to export explicitly
We're currently unintentionally exporting a bunch of symbols that should
remain local to sub-modules. Use __all__ where appropriate so that we
don't re-export standard library functions such as select() etc. in the
gpiod module.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-05-25 15:30:25 +02:00
Bartosz Golaszewski
a0b8bcee3f bindings: python: change the interpretation of None in event wait
The docs don't mention it but currently passing None as the timeout to
one of the event wait methods works like passing 0 to select() - the wait
method returns immediately. Change it to a more standard behavior - None
makes the method block indefinitely until an event becomes available for
reading.

This is a slight change in the behavior but let's hope nobody complains
as libgpiod v2 is still pretty recent and its adoption is (hopegully)
not wide-spread yet.

Reported-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Suggested-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
2023-05-24 11:12:49 +02:00
Viresh Kumar
f6308c1307 bindings: fix typo "SPDX-FileCopyrightTest" in copyright headers
It should be SPDX-FileCopyrightText instead. Fix it.

Reported-by: Erik Schilling <erik.schilling@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Erik Schilling <erik.schilling@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-05-23 11:02:51 +02:00