[arch-dev-public] Strange behaviour of pacman

Aaron Griffin aaronmgriffin at gmail.com
Mon Oct 19 15:08:33 EDT 2009

On Mon, Oct 19, 2009 at 2:03 PM, Daniel Isenmann <daniel.isenmann at gmx.de> wrote:
> On Mon, 19 Oct 2009 14:45:20 -0400
> Eric Bélanger <snowmaniscool at gmail.com> wrote:
>> On Mon, Oct 19, 2009 at 2:06 PM, Travis Willard <twillard2 at gmail.com>
>> wrote:
>> >> As I can see now, these are .pyo files. Are they generate at
>> >> runtime or something like that? They are not in the package.
>> >>
>> >
>> > .pyo files are, I believe, "optimized" python files generated
>> > during runtime.
>> >
>> I beleiie so too.  I think there was a thread about how to deal with
>> these files.  I think the info is in a wiki article about python
>> packaging guidelines. The other remaining file is wicd.log wich is
>> generated at runtime too.
> I have nothing found about those files. The article about python
> package guidelines is very short. Nothing special about it.
> The log file is acceptable, but the pyo files are annyoing.

I imagine that this only happens with apps run as root (or have write
permissions to their install dir).

I think the best thing, for the time being, is to do this in a
pre_remove (so you have access to pacman -Ql at that time) and do
something like:

pre_remove () {
    for pyo in $(pacman -Qql $PKGNAME  | grep \.py$ | sed 's|.py$|.pyo|g'); do
        if [ -f "$pyo" ]; then
            rm "$pyo"

More information about the arch-dev-public mailing list