Commit Graph

6 Commits

Author SHA1 Message Date
Todd C. Miller
75b9a26a37 If the signal.Signals enum is not present, search the dictionary.
The Signals enum was added in Python 3.5.  If it is not present we
need to iterate over the dictionary items, looking for signal name
to number mappings.  Fixes the signal tests with Python 3.4.
2020-04-09 10:49:59 -06:00
Robert Manner
45d2638571 plugins/python/example*.py: pep8 fixes (mainly line too long) 2020-02-10 05:24:16 -07:00
Robert Manner
21c02e1732 plugins/python/sudo_python_module.c: use IntEnums instead of constants
It is a bit more code, but it is more "pythonic" and easier to debug
as the enum values also know their names.

It is also an API break, eg. sudo.RC_OK becomes sudo.RC.OK as sudo.RC will
be the "type" of the enum, but I guess that is acceptable before the
initial release.
2020-02-10 05:24:16 -07:00
Robert Manner
f3b7f3c0d4 plugins/python/example_{io,conversation}: avoid printing signal number
They are platform dependant, so their test would fail on some platforms.
While we could create separate plugin for the tests, I like the idea that
the examples are ensured to be working.

I believe this is a good compromise for being able to auto update the
test cases.
2020-01-20 06:30:20 -07:00
Robert Manner
87d76f4bbc plugins/python/example_conversation.py: make log path configurable
Similarly to IO plugin example. (It is easier to test it this way.)
2020-01-20 06:30:20 -07:00
Robert Manner
4ad362dd8f plugins/python: example plugin demonstrating conversation and debug API 2019-12-14 12:55:42 -07:00