[issue14443] Distutils test_bdist_rpm failure

Dave Malcolm report at bugs.python.org
Wed May 30 02:38:25 CEST 2012


Dave Malcolm <dmalcolm at redhat.com> added the comment:

I'm able to reproduce this on a RHEL 6 box, and I did some investigating.  The stray .pyc files are indeed reported by "file" as "python 2.6 byte-compiled" so yes, it's using /usr/bin/python to byte-compile them

On RHEL 6, with redhat-rpm-config-9.0.3-33.el6.noarch, /usr/lib/rpm/redhat/macros defines os_install_post as:
%__os_install_post    \
    /usr/lib/rpm/redhat/brp-compress \
    %{!?__debug_package:/usr/lib/rpm/redhat/brp-strip %{__strip}} \
    /usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} \
    /usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \
    /usr/lib/rpm/brp-python-bytecompile \
    /usr/lib/rpm/redhat/brp-python-hardlink \
    %{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \
%{nil}

Note how in this definition, brp-python-bytecompile is passed in without any arguments (contrast with msg159396, which is from a later version of the macros).

Hence it unconditionally (and erroneously) uses /usr/bin/python to byte-compile any .py files found in the package payload.

The change to add %{__python} to the invocation of /usr/lib/rpm/brp-python-bytecompile appears to have been in redhat-rpm-config-9.1.0 for Fedora 13 (see https://bugzilla.redhat.com/show_bug.cgi?id=521141), whereas RHEL 6 has the earlier code.

It may be possible to work around this by providing an overridden definition of __os_install_post in the specfile.  We do this in the python26.spec for EPEL5; grep for "__os_install_post" within:
http://pkgs.fedoraproject.org/gitweb/?p=python26.git;a=blob;f=python26.spec;h=6b490b9b71f42c26b7d4ec4031685fb3230c5602;hb=refs/heads/el5

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14443>
_______________________________________


More information about the Python-bugs-list mailing list