[openstack-dev] battling stale .pyc files

Vishvananda Ishaya vishvananda at gmail.com
Fri Sep 19 07:06:03 UTC 2014


On Sep 15, 2014, at 4:34 AM, Lucas Alvares Gomes <lucasagomes at gmail.com> wrote:

> So, although I like the fix proposed and I would +1 that idea, I'm
> also not very concerned if most of the people don't want that. Because
> as you just said we can fix it locally easily. I didn't set it to my
> .local but the way I do nowadays is to have a small bash function in
> my .bashrc to delete the pyc files from the current directory:
> 
> function delpyc () {
>   find . -name "*.pyc" -exec rm -rf {} \;
> }
> 
> So I just invoke it when needed :)

fyi there is a -delete option to find which is probably a little safer then exec with a rm -rf. Also it is really convienient to do this as a git alias so it happens automatically when switching branches:

In ~/.gitconfig:

[alias]
    cc = !"TOP=$(git rev-parse --show-toplevel) find $TOP -name '*.pyc' -delete; git-checkout”

now you can git cc <branch> instead of git checkout <branch>.

Vish


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140919/e009696d/attachment.pgp>


More information about the OpenStack-dev mailing list