Hi!
On 05/27/2016 07:44 PM, John Dennis wrote:
On 05/27/2016 10:10 AM, Tomas Orsava wrote:
I think the python2-XXX package in the examples is missing something like this:
Requires: %{_bindir}/sample-exec
Make sense?
I believe there is a misunderstanding. In your first message you said "But the guidelines require the py3 version of the script in the py2 package." That is incorrect.
The guidelines only require you to package the Python 3 version of the script. They are not very clear on where you should put it, but the only logical place is of course the Python 3 subpackage (or a new subpackage with only the executable script that relies on the Python 3 subpackage).
You should never put the Python 3 executable in the Python 2 subpackage.
That's fine. But unless one of two things are done the guidelines as they currently stand will leave you with a broken python2-XXX package. You either have to copy the Py2 version of the script to %{_bindir}/sample-exec-2.7 after the %py2_install runs instead of deleting the scripts as is currently recommended. -OR- you need to add a Requires on the %{_bindir}/sample-exec to the python2-XXX package as I suggested above.
If one of these 2 things are not done then someone installing just the python2-XXX version of the package (what I expect might be a common user action) will not have a script that can execute.
That is as it should be. The application should be provided in only one subpackage, not both, unless it behaves differently on Python 2 and Python 3 (example would be e.g. pip that does behave differently). If the user wants the application, they will have to install the Python 3 subpackage.
Also neither set of guidelines include examples of setting up links if you elect to use versioned scripts (e.g. %{_bindir}/sample-exec-2.7, %{_bindir}/sample-exec-3.5). The guidelines seem to suggest it's best to avoid versioned scripts which I would agree with, if that is the case then of the two options discussed above only the Requires fix will work.
The guidelines are indeed flawed. But the Python RPM Packaging Guide (not part of the guidelines) does include examples of this [0]. However, it's only explained in the 4th chapter—chapter for packages where the executable behaves differently depending on the Python version (2 or 3). In all other cases you should not use versioned executables as the executable shall be included in only one version.
[0] http://python-rpm-porting.readthedocs.io/en/latest/tools.html