[Buildroot] [PATCH 2/2] utils/scanpypi: allow installation of commands without 'main' method

Peter Korsgaard peter at korsgaard.com
Thu Aug 5 20:07:38 UTC 2021


>>>>> "Thomas" == Thomas De Schampheleire <patrickdepinguin at gmail.com> writes:

 > From: Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
 > In case the setup.py file of a python package does not directly call the
 > 'setup' method, utils/scanpypi was hoping there be a 'main' function which
 > would do the work, normally called via a construct like:

 >     if __name__ == '__main__':
 >         main()

 > However, this construct is nonstandard, and there are packages in PyPI which
 > call 'setup()' directly from the 'if' statement, without a main() method.

 > But scanpypi does not actually need to make such assumption: when loading
 > the module, it can decide the name to be '__main__', just as if setup.py
 > would be loaded interactively.

 > Additionally, remove some logic seemingly related to the previous trick of
 > calling 'main'. There should not be a problem in keeping already loaded
 > modules in sys.modules, as this is the purpose of sys.modules.

 > Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>

Committed to 2021.02.x and 2021.05.x, thanks.

-- 
Bye, Peter Korsgaard


More information about the buildroot mailing list