[Distutils] zc.buildout generated console scripts with sys.exit
jim at zope.com
Sat Jan 9 17:59:50 CET 2010
On Fri, Jan 8, 2010 at 7:28 PM, Olaf Conradi <olaf at conradi.org> wrote:
> I wanted use zc.buildout for a program that I wrote, but noticed that the
> generated console script does not call sys.exit, unlike setuptools.
> My main function uses a structure as explained by Guido in
> def main(argv=None):
> if argv is None:
> argv = sys.argv
> # ...
> return 0
> if __name__ == "__main__":
> Can this be supported?
Yup. This will be in a future release.
I've resisted this in the past, because I'd never seen the return
value of main specified before and there's a long tradition of main
functions returning None (by not returning anything), but I see that
sys.exit treats None the same as 0.
> I noticed a patch is attached to
Unfortunately, this patch doesn't include a test, although updating
the tests will be trivial, since applying the patch will make existing
tests fail. (Maybe one of the other buildout maintainers will get it
done before me. :)
More information about the Distutils-SIG