[arch-dev-public] Strange behaviour of pacman

Aaron Griffin aaronmgriffin at gmail.com
Mon Oct 19 16:10:24 EDT 2009


On Mon, Oct 19, 2009 at 3:08 PM, Daniel Isenmann <daniel.isenmann at gmx.de> wrote:
> On Mon, 19 Oct 2009 16:02:15 -0400
> Eric Bélanger <snowmaniscool at gmail.com> wrote:
>
>> On Mon, Oct 19, 2009 at 3:56 PM, Aaron Griffin
>> <aaronmgriffin at gmail.com> wrote:
>> > On Mon, Oct 19, 2009 at 2:49 PM, Eric Bélanger
>> > <snowmaniscool at gmail.com> wrote:
>> >> On Mon, Oct 19, 2009 at 3:38 PM, Aaron Griffin
>> >> <aaronmgriffin at gmail.com> wrote:
>> >>> On Mon, Oct 19, 2009 at 2:21 PM, Daniel Isenmann
>> >>> <daniel.isenmann at gmx.de> wrote:
>> >>>> On Mon, 19 Oct 2009 14:08:33 -0500
>> >>>> Aaron Griffin <aaronmgriffin at gmail.com> wrote:
>> >>>>
>> >>>>> 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:
>> >>>>>
>> >>>>> PKGNAME=wicd
>> >>>>> pre_remove () {
>> >>>>>     for pyo in $(pacman -Qql $PKGNAME  | grep \.py$ | sed
>> >>>>> 's|.py$|.pyo|g'); do if [ -f "$pyo" ]; then
>> >>>>>             rm "$pyo"
>> >>>>>         fi
>> >>>>>     done
>> >>>>> }
>> >>>>
>> >>>> Ok, I will do it this way, but shouldn't we have a better
>> >>>> solution for this for the future?
>> >>>
>> >>> Well, the only sane way to do it would be to make sure pacman
>> >>> tracks the .pyo files by generating them as part of the package
>> >>> creation process, but I don't even know if that's possible
>> >>>
>> >>
>> >> it's possible. Just create empty files with the same name with
>> >> 'touch' in the build function.
>> >
>> > Looks like python -O py_compile.py foo.py will do this. And it looks
>> > like setuptools has an --optimize argument. I'd suggest trying this
>> >
>> > python setup.py install --optimize=1 ...other args...
>> >
>>
>> yeah, just found that here:
>> http://wiki.archlinux.org/index.php/User:Allan/Python_Packaging_Policy
>
> Why wasn't that added to the "official" Python Packaging Policy here:
> http://wiki.archlinux.org/index.php/Python_Package_Guidelines
>
> I will change that in the next package version of wicd. I just
> committed the other "fix", don't want to release the next package
> right now. Have to remember that page.

Added it :)


More information about the arch-dev-public mailing list