Ok, this is a quicky i found here.
I use bdist_rpm when building python modules, because I like them to be neatly installed as rpms, but it normally breaks, puking over not packaged pyo files.
Just put this:
in the project’s setup.cfg, or perhaps better yet, in ~/.pydistutils.cfg or
in $prefix/lib/python2.x/distutils/distutils.cfg. This will then always
set –optimize=1 when install is invoked.
This way bdist_rpm will not break (hopefully). Or at least not on pyo files.
Tried it with the Skype4Py package, it worked like a charm.