lcitool: __main__: Prevent running main() on import
When commit f0cc11e3 introduced the module, it did it so that: 1) it complies with PEP 517 [1] 2) lcitool could be executed as a Python module The implementation is based on having a __main__.py module which Python can automatically import. The problem is that when the main function is imported from the module from within the automatic executable wrapper created when the package is installed, it executes the whole module on import (standard behaviour). At the end of the module there's an unguarded call to the main() function. Fix this with the '__name__ == "__main__"' idiom. Fixes: f0cc11e3 [1] https://peps.python.org/pep-0517/ Signed-off-by:Erik Skultety <eskultet@redhat.com>
Loading
Please register or sign in to comment