Python packages failing to build (bdist_rpm) on Fedora 6?
Then I’ve got the cure.
Most Python packages fail to build using the traditional python setup.py bdist_rpm process with an Installed (but unpackaged) files found error message, and a list with a bunch of .pyc and .pyo files.
If this is the problem, I know why it arises, and how to solve it.
Why?
First, let me assure you: you are not doing anything wrong. It’s a Fedora 6 issue.
Because there’s a post-process script that Fedora runs named /usr/lib/rpm/brp-python-bytecompile. This fucks up the RPM buid process because it compiles byte-optimized versions of the Python files to be installed. Of course, bdist_rpm is not aware of this, so it can’t inform RPM that those files will also be added to the package. What does this mean? It means that RPM finds those files and says Oh, damn, these files don’t belong here, I better bomb out
.
The script is a complete fuckup, and it contains at least two bugs.
How I solved it
I opened it in my favorite text editor, located these two lines:
# Generate normal (.pyc) byte-compiled files. $python -c 'import compileall; .... (something irrelevant)
Generate optimized (.pyo) byte-compiled files.
$python -O -c 'import compileall; (something equally irrelevant)
and commented those two lines beginning with $python, like this:
# Generate normal (.pyc) byte-compiled files. #$python -c 'import compileall; .... (something irrelevant)
Generate optimized (.pyo) byte-compiled files.
#$python -O -c 'import compileall; (something equally irrelevant)
You should do so too.
And once Fedora 7 comes out, if this fuckup persists, you bet you’ll be able to do this again.
September 23rd, 2007 at 21:45
I don’t see how this can work … when the corresponding .py script is first run, it will try to drop at least a .pyc in that same directory, which will absolutely fail unless the invoking user is root…
The pyc (and pyo) file needs to be included in the rpm. There must be another way to let the spec file know about this.
September 23rd, 2007 at 21:49
http://groups.google.com/group/Numpy-discussion/browse_thread/thread/6db084a9f2b06d6b/830cf4c5c28e0073?hl=en&lnk=st&q=setup.py+rpm+Installed+(but+unpackaged)+file(s)+found&rnum=3#830cf4c5c28e0073