Le Thu, 22 Oct 2009 16:13:33 -0500, Aaron Griffin <aaronmgriffin@xxxxxxxxx> a écrit : > >> > I have found a way to automate that which is, I believe, not PKGBUILD-dependant. > >> > > >> > Here's what I do in the PKGBUILD: > >> > > >> > [...] > >> > install="pyo_remover.install" > >> > [...] > >> > build() { > >> > [...] > >> > # Take care of .pyo files > >> > cd $pkgdir > >> > echo "post_install() {" > $startdir/$install > >> > for _i in $(find . -name '*.pyo'); do > >> > echo "rm -f "$(echo "$_i" | cut -c2-) >> $startdir/$install > >> > echo > "$_i" > >> > done > >> > echo -e '}\npost_upgrade() {\npost_install $1\n}\n' >> $startdir/$install > >> > } > >> > > >> > pyo_remover.install can be anything, even an empty file. For packages that need a .install file this has to be adapted. > >> > > >> > Does this look like a good way to solve the problem? I know the way I do it for now is kind of ugly, but I think it could be much cleaner if the same kind of thing was done directly by makepkg. > >> > >> > >> Did you mean for this to be post_install? This should be done on > >> remove, if I'm not mistaken, as the pyo files are actually a good > >> thing > > > > No, I meant that to be post_install, because that way: > > > > - Pacman will track the .pyo files because they are in the package (as empty text files), so they will be deleted on removal. > > > > - The .pyo files will be deleted after install so I think they will be re-generated at runtime. This means there will always be generated for the right architecture and Python version. > > > > By the way I think you can do the same for .pyc files. > > This requires that the program has write access to those files, which > is generally not the case This is true. A way to fix it would be to run 'python -O -mcompileall -q /usr/lib/python2.6' as root. That will generate .pyo files for all python packages though, so it means all the packages have to track theirs, otherwise there will be stray files. -- catwell