[Distutils] bdist_rpm fails due to bytecompiled modules

Christopher Blunck chris at wxnet.org
Wed Oct 25 23:37:59 CEST 2006

On Wed, Oct 25, 2006 at 05:15:32PM -0400, Konstantin Ryabitsev wrote:
> On 10/25/06, Christopher Blunck <chris at wxnet.org> wrote:
> >how do you workaround the "installed (but unpackaged) file(s) found"
> >error related to the .pyo/.pyc files?  i noticed it's a python bug as
> >well as a redhat bug.
> 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...


WeatherNet Observations for station:  home
Temperature: 51.60F		Pressure: 30.04in;
Dew Point:   33.02F (49%)	Wind:     81 at 0 mph
Recorded:    21:24:56 10/25/06  (http://wsdl.wxnet.org/inquiry/binding.wsdl)

More information about the Distutils-SIG mailing list