On Fri, Jan 8, 2010 at 7:28 PM, Olaf Conradi <[email protected]> wrote:
> Hello,
>
> 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
> http://www.artima.com/weblogs/viewpost.jsp?thread=4829
>
> def main(argv=None):
>     if argv is None:
>         argv = sys.argv
>     # ...
>     return 0
>
> if __name__ == "__main__":
>     sys.exit(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
> https://bugs.launchpad.net/zc.buildout/+bug/164629

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. :)

Jim

-- 
Jim Fulton
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to