[RFC][win32] bzr.exe -- launcher for bzr script

Jan Hudec bulb at ucw.cz
Sun Jan 15 07:58:41 GMT 2006


On Sun, Jan 15, 2006 at 04:25:42 +0200, Alexander Belchenko wrote:
> I try to make exe launcher for bzr to use on win32. I slightly modify
> Fredrik Lundh's exemaker source to allow exe to launch script without
> .py extension. It's almost works.
> 
> There is one thing that I don't understand yet. Bzr script use this hack
> to determine is python executed with -OO optimization option:
> 
> if __doc__ is None:
>      print "bzr does not support python -OO."
>      sys.exit(2)
> 
> Unfortunately, when bzr launched within exemakered exe launcher this
> condition is True and bzr won't work. I slightly change this to:
> 
> if not __debug__ and __doc__ is None:
>      print "bzr does not support python -OO."
>      sys.exit(2)
> 
> And it works. Mostly because from exe python executed without -O/-OO
> options. I make this assumption by the fact that in bzrlib no .pyo files
> appeared after bzr execution.

Does it? Really? Does bzr help init (or any other command) print what it
should?

> Is this acceptable change to bzr script or there is right way to avoid
> this inside exe? Attached patch will change condition to determine -OO
> python optimization option.

But it is not trying to determine -OO, really. It is trying to determine
presence of doc strings, which is exactly what it does. Because bzr keeps
help and various messages in doc strings.

-- 
						 Jan 'Bulb' Hudec <bulb at ucw.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060115/e8999552/attachment.pgp 


More information about the bazaar mailing list