Skip to content
Commit 2fa24dce authored by Erik Skultety's avatar Erik Skultety
Browse files

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: default avatarErik Skultety <eskultet@redhat.com>
parent 51dad419
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment