On 28. 06. 21 22:25, Dan Čermák wrote:
Miro Hrončok <mhroncok(a)redhat.com> writes:
> Hello Python RPM packagers,
> based on some discussion in the "F35 Change: Python Packaging Guidelines
> overhaul (System-Wide Change proposal)" thread , I've drafted a macro
> can help to test-import a Python module in %check when no other tests exist or
> are when they cannot be executed during build .
> The semantics is quite simple:
> %py3_check_import mymodule mymodule.submodule
This looks pretty good imho. Would it somehow be possible for the macro
to automatically try to import the module name from the generated
python3.Ydist() provides? That would make the macro even more convenient
to use and reduce any potential user error further.
Honestly, I'd rather not do that. People already confuse "module names"
what you import) with "Python package names" (that's what you install from
or what's provided as python3.Ydist()). And while this would make the macro
slightly easier to use for the optimal case when those names are identical, it
would only create more confusion when they are not.
In the future, we could extend it to automatically import modules found in the
%buidlroot, but now I'd rather provide a simple tool where the packager needs
to be explicit, than a very complex tool that does heuristics.