Daniel Harding wrote:
I would make one improvement on what you have, and simply pass the code
to python using the -c command line option. This removes the need for
an additional file. pylint.bat then becomes:
@echo off
python -c "import sys; from pylint import lint; lint.Run(sys.argv[1:])" %*
Any reason this wouldn't work?
Found one problem, actually. When using -c, sys.argv[0] becomes "-c",
so when running 'pylint --version', the output with my change became
-c 0.18.1,
astng 0.19.1, common 0.45.2
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)]
(FWIW, I also noticed that 'pylint --version' with the released version
of pylint.bat actually displays 'pylint.bat' rather than simply
'pylint'.)
A possible fix for this is to overwrite sys.argv[0] before calling
lint.Run. This seems like a bit of a hack, but I grepped through the
source of pylint and sys.argv[0] isn't referenced explicitly anywhere -
just via %prog in the optparse usage and version strings. So, I don't
think it should cause any problems. In this case, pylint.bat becomes:
@echo off
python -c "import sys; from pylint import lint; sys.argv[0] = 'pylint';
lint.Run(sys.argv[1:])" %*
Any other potential issues?
Daniel Harding
_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects