Hi,
What if the call to main() in python-based core modules gets changed to just
if __name__ == "__main__":
main()
it will import all required modules, and still not call main() if imported.
Opinions?
Hi,
What if the call to main() in python-based core modules gets changed to just
if __name__ == "__main__":
main()
it will import all required modules, and still not call main() if imported.
Opinions?
I’m ok with that main() change being made more or less wholesale, yes.
The patch must be very careful to make it everywhere, and not do anything else.
Hi Micahel,
Thanks for that.
I've submitted a PR as defining top-level env 'just' for main(), import extensible modules from new lib by abhishekkr · Pull Request #9120 · ansible/ansible · GitHub
and the shortened diff is attached here as well just showing it's just
meddling with main() call.
Also, I had a related query that I've commented here... (for when you have time)
file.diff.log (25.6 KB)
The one thing that doesn’t really make sense though is “modules plainly extensible via import”… this isn’t actually true, due to the way variables coming into the module are processed - which is why this wasn’t done this way originally.
Curious on background if you care to elaborate?