Not 100% sure if this is a bug, but it would appear to me that this isn't set as _internal and is therefore showing up in fab --list.
Wouldn't normally be an issue, but I'm trying to make --list tidy enough for some completely non-tech staff to be able to look at it and use defined tasks.
FYI, the same happens with fabric.colors. Again, not sure if this is actually a bug.
Originally submitted by Nick Trew (vxnick) on 2011-04-20 at 08:42am EDT
Jeff Forcier (bitprophet) posted:
Sounds like a bug. What version are you using?
on 2011-04-20 at 10:23am EDT
Nick Trew (vxnick) posted:
I'm using master 1.0.1
on 2011-04-20 at 10:25am EDT
I'm having the same issue with colors showing up when using fab -l; I'm using 1.3.1 from PyPI.
epicserve on IRC is having this too, with colors.green (imported as: from fabric.colors import green), and he is using fab 1.3.3 and using @task on his tasks in the fabfile.
from fabric.colors import green
I can't reproduce the problem with a barebones fabfile that just imports green and task and defines a single task.
However, I can reproduce it with epicserve's fabfile. Trimming down it looks like @roles is the key. Need to figure out why.
Turns out he had @roles above @task, which normally would hide the task entirely (@task has to come on top to work correctly, as per #410) but since he is decorating all tasks with @roles (above @task), the Fab import mechanisms don't actually see any new-style tasks, which falls back to classic-style task searching, and that's why green is being picked up.
To @dholt and @vxnick could you check to see if this was the problem for you as well? (I.e. not having @task before other decorators, and that probably on all tasks in the file.) If so, I'll close this as a dupe of #410, which will then get a higher priority since it's causing these problems too.
Edit: to be clear, the problem is doing this:
Which should be this instead:
I believe I wasn't using @task at all when I posted that comment; I added @task shortly after and it did seem to fix the problem.
Likewise, this was before I was using @task.
OK, thanks guys -- good to know.
I'll try and remember to ensure fabric.colors is marked as internal so that it doesn't bite anybody still using old-style tasks. Was probably holding off on that because it wasn't super public pending #101, but at this point it's been around long enough to require full treatment.
Leaving this open until I handle that.
Fixed in 56ceefb (missed the # in the commit, sigh).
The next release for 1.1.x, 1.2.x and 1.3.x will mask out fabric.colors.* from fab -l.
Changelog entry re #339