On Fri, 3 Dec 2021, Jim Klimov via Nut-upsdev wrote:
Just in case, regarding the spin-off topic of Python scripting: note there is a sort of binding in NUT sources, as used in GUI app etc.
I am not sure what practical state it is in, e.g. if it may need more attention for NUT data points and concepts added in recent years,...
If I remember correctly, the "binding" proposed is object oriented. Python is now de-emphasizing OO in order to attract more interest. Does the NUT project need to support Object Orientation when NUT is essentially event oriented?
In master branch, it was recently fixed to pass self-test with both Python 2.x and 3.x (several sub-versions).
Python 2 support ended on 2020-01-01 and now has status "end-of-life". I don't see any need to support it in NUT.
...but I suppose fixing it in upstream (if needed) is better than everyone reinventing their wheel ;)
I wrote a Python replacement for upsmon, upssched and upssched-cmd. It introduces the concept of groups of UPS's with different groups having different behaviours. For example heartbeat dummy UPS's have their own group since there is no need to log heartbeat status changes.
The biggest wheel I re-invented was the decoding of the new configuration file. I used PLY (Python Lex-Yacc) by David Beazley. The advantage is that it doesn't require separate Lex and Yacc specificationn files, but the result is difficult to read, and if I were to do it again I would look for a real Lex and Yacc.
Roger _______________________________________________ Nut-upsdev mailing list [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev
