Discussion:
How to disable brp-python-bytecompile
Mike Meyer
2007-11-13 23:46:12 UTC
Permalink
Hi all,

I'm trying to build an rpm from a python application for a client to
run on both RHEL4 and RHEL5.

rpmbuild has the rather nasty habit of runing
/usr/lib/rpm/brp-python-byteompile, which goes through all the files
to be installed by the rpm, and compiling any .py files it finds into
.pyo files.

The first problem is that, while the resulting rpm claims to be
noarch, I can't find anything from the Python folks promising that
.pyo (and .pyc) files are architecture-dependent, so this would seem
to be an error even in the general case, but that's not really my
problem.

My issues is that the resulting .pyo are just so much wasted space.
They don't work on one of the two platforms we're going to deploy to,
because the two pythons are different (2.3 vs. 2.4), and use different
versions of the byte code.

That this all happens after the install scripts run means I can't use
the rpm build process to clean up after it. The best I've been able to
do is use a post-install script to delete the garbage files it
installs - which means the rpm carries them around, we install them,
and then delete them, which is just ugly, and seems error-prone as
well.

Ideally, there's a knob somewhere I can twist to disable
brp-python-bytecompile at rpm build time, and I can then fix the
install scripts to byte-compile the things I need.

Failing that, is there someplace I can hook a script in to clean these
files up *before* the rpm gets built from them, but after
brp-python-bytecompile runs?

thanks,
<mike
--
Mike Meyer <***@mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
Valery Reznic
2007-11-14 07:14:42 UTC
Permalink
--- Mike Meyer <mwm-keyword-***@mired.org>
wrote:
In the file /usr/lib/rpm/redhat/macros
defined something like:

%__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-java-repack-jars \
%{nil}

You can redefine it in your specfile or on the command
line with rpmrebuild invocation.

Another option is change
/usr/lib/rpm/brp-python-bytecompile
just add 'exit 0' after '#!/bin/sh' line

Valery.
Post by Mike Meyer
Hi all,
I'm trying to build an rpm from a python application
for a client to
run on both RHEL4 and RHEL5.
rpmbuild has the rather nasty habit of runing
/usr/lib/rpm/brp-python-byteompile, which goes
through all the files
to be installed by the rpm, and compiling any .py
files it finds into
.pyo files.
The first problem is that, while the resulting rpm
claims to be
noarch, I can't find anything from the Python folks
promising that
.pyo (and .pyc) files are architecture-dependent, so
this would seem
to be an error even in the general case, but that's
not really my
problem.
My issues is that the resulting .pyo are just so
much wasted space.
They don't work on one of the two platforms we're
going to deploy to,
because the two pythons are different (2.3 vs. 2.4),
and use different
versions of the byte code.
That this all happens after the install scripts run
means I can't use
the rpm build process to clean up after it. The best
I've been able to
do is use a post-install script to delete the
garbage files it
installs - which means the rpm carries them around,
we install them,
and then delete them, which is just ugly, and seems
error-prone as
well.
Ideally, there's a knob somewhere I can twist to
disable
brp-python-bytecompile at rpm build time, and I can
then fix the
install scripts to byte-compile the things I need.
Failing that, is there someplace I can hook a script
in to clean these
files up *before* the rpm gets built from them, but
after
brp-python-bytecompile runs?
thanks,
<mike
--
http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email
for more information.
_______________________________________________
Rpm-list mailing list
https://www.redhat.com/mailman/listinfo/rpm-list
____________________________________________________________________________________
Be a better sports nut! Let your teams follow you
with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
Loading...