[arch-dev-public] Strange behaviour of pacman

Aaron Griffin aaronmgriffin at gmail.com
Mon Oct 19 15:56:02 EDT 2009


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...


More information about the arch-dev-public mailing list