On 05/11/2016 05:16 PM, John Dennis wrote: > I've been following the guidelines for Python packaging found here: > > https://fedoraproject.org/wiki/Packaging:Python > > in particular the cookbook for supporting both Py2 and Py3. > > I've discovered two places where things fail to work as expected with > respect to script installation. Both of these problems took an > inordinately long time to fully diagnose. The first problem I believe is > a bug in the python rpm macros and needs to be fixed (filed as bug > #1335203). The second problem can be fixed via a workaound in the spec > file, but the cookbook recipe will need to be updated to call attention > to it.
Could you file bugs, please? [...] > Problem 2: > ---------- > > The Py2 version of the script (which forces /usr/bin/python2 in it's > shebang line) is installed in the python3 package. Thus if you install > python3-NVR and it has a script in /usr/bin you'll end up executing > python2 instead of python3. > > The cookbook shows this snippet: > > %install > # Must do the python2 install first because the scripts in /usr/bin are > # overwritten with every setup.py install, and in general we want the > # python3 version to be the default. > %py2_install > %py3_install > [...] > > The result is the python3-package ended up with a script with a Py2 > interpreter shebang line, clearly this is wrong. > > The workaround I came up with is to delay the execution of %py3_build by > at least 1 second by inserting a sleep in-between the %py2_build and > %py3_build macros in the spec file, like this: > > %py2_build > sleep 1 > %py3_build > > Actually I think sleeping 2 seconds might be safer given the 1 second > resolution on the timestamps. A better workaround would be 'rm /usr/bin/xyz' instead of the sleep. Nevertheless, this should indeed be acknowledged in both the Packaging guidelines, and in the RPM porting guide [0]. Tomáš, can you take care of the guide? Unfortunately, changing the Guidelines isn't trivial – we have a ticket that's been sitting in FPC's queue for half a year [1]... [0] http://python-rpm-porting.readthedocs.io/en/latest/index.html [1] https://fedorahosted.org/fpc/ticket/558 -- Petr Viktorin _______________________________________________ python-devel mailing list python-devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/python-devel@lists.fedoraproject.org