Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow fabric to be invoked as a Python module (with -m) #975
I use this change every day. Now that I use Python 3 for my main environment, but because fabric doesn't yet support Python 3, I need an easy way to invoke fabric from Python 2. What I've been doing is this:
On Windows with pylancher, that invokes fabric under Python 2 (where fabric is installed with this patch). I don't have to have any entry points or worry about execution paths or Python 3 'fab' executable taking precedence.
The same advantages would apply on a Unix environment:
That would invoke fabric under python2.7 even if 'fab' resolves to another Python version.
This change leverages well-defined Python standard defined in PEP 338, and as far as I know has no disadvantages.
Looks like this only functions correctly under Python 2.7 and up; 2.5 behaves like it's a no-op and 2.6 complains because
Still, it can hardly hurt anything for the older Pythons, so I think I may just note this in the changelog for CYA (COA?) purposes.