[Distutils] bdist_rpm fails due to bytecompiled modules

Konstantin Ryabitsev icon at fedoraproject.org
Thu Oct 26 22:23:01 CEST 2006


On 10/25/06, Christopher Blunck <chris at wxnet.org> wrote:
> > Not sure what you call a bug here. The creation of .pyc and .pyo files
> > is an important stage and shouldn't be omitted when building RPMs, nor
> > should the files be skipped (deleted and not included in %files). This
> > way stuff like SELinux permissions get set correctly when the RPM is
> > installed.
>
> distutils/setuptools creates .pyc files - that's ok.
>
> here's how the problem occurs:
>
> 1.) distutils generates a .spec file with an %install that calls
>     setup.py like below.  .py and .pyc files are generated, and are
>     included in the INSTALLED_FILES record.  see below for what is
>     called in %install:
>
> python setup.py install --single-version-externally-managed --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
>
>
> 2.) rpmbuild is called, and it generates a shell script that calls the
>     command above.  AFTER that command is executed, rpmbuild calls some
>     strip commands as well as brp-python-bytecompile.
>     brp-python-bytecompile generates .pyo files from .pyc but it does not
>     update INSTALLED_FILES (because that is a distutils artifact that
>     rpmbuild doesn't know about)
>
> 3.) rpmbuild calls into %install, and INSTALLED_FILES is loaded.  it
>     does not include the .pyo files that rpmbuild created.  since
>     there are unpackaged files (the .pyo files) that exist in the
>     installation directory that are not referenced in the
>     INSTALLED_FILES file, rpmbuild chokes with an error.
>
>
> step #3 is where the error occurs.  it's basically an inconsistency
> between distutils and rpmbuild.  i can run distutils to generate
> optimized modules (.pyo) but that doesn't apply to my scripts.  as a
> result i still have unpackaged files...

Yes, it looks like distutils is not anticipating the new behaviour
from rpmbuild (both .pyc and .pyo will be compiled by
brp-python-bytecompile). It's probably something that should be fixed
when generating the %files section.

Regards,
-- 
Konstantin Ryabitsev
Montréal, Québec


More information about the Distutils-SIG mailing list