[RFC] executable on windows

Alexander Belchenko bialix at ukr.net
Fri Mar 24 09:28:36 GMT 2006


Jan Hudec пишет:
>>>To accomodate both styles, I propose we rename bzr to bzr.py and create
>>>a new bzr that simply invokes bzr.py.
>>>
>>>Thoughts?
> 
> Very, very ugly.
> 
> On Windows, a .bat should be created to invoke python bzr.

As I say, current version of bzr setup do this: it create bzr.bat as
simple launcher with this content:

@full\path\to\python24.exe full\path\to\bzr $*

You can looking at setup.py script: class my_install_scripts.

> 
> We could also generate appropriate '#!'-sequence for windows and rename
> bzr to bzr.bat there. The sequence is something like (NT/XP only):
> 
> @goto RunPython
> """
> :RunPython
> @\Path\To\python.exe -x "%0" %*
> @goto :EOF
> """
> <python code follows...>
> 
> There should be some if errorlevel things and such so it exits with
> proper status.

Very interesting hack. But I think it's too complicated. I'm OK with
current simple batch launcher. At least it returns true errorlevel.

> 
> The installer should do this on windows. Folks running bzr without
> installing are hopefuly able enough to create a one-line batch or
> shortcut for them.
> 

Well, I think installer *should be* improved. If we look at default
windows installation and imagine the user that want to use bzr but have
no knowledge about python then we see this typical situation:

1) user download and install python
2) [probably] user download and install ElementTree + cElementTree
3) user download and install bzr
4) user open cmd shell and type 'bzr' and got "bzr is not recognized as
an internal or external command, operable program"...

That's because after (or during) step 3 user (or installer) needs to add
at least C:\Python24\Scripts (or other appropriate path) to $PATH
environment variable. So, our installer should do more job on windows in
addition to copy files to python\site-packages and python\Scripts. We
have some alternatives:

1) explicitly point user to need to modify $PATH
2) implicitly modify $PATH
3) rename 'bzr' -> 'bzr.py' and modify $PATH and $PATHEXT to make 'bzr'
command work in cmd shell
4) make TortoiseBZR (it took 3-6-9 months? to complete) and hide all
$PATH* stuff and usage of cmd shell from unexperienced users.

I think at this moment simpliest way to go to variant 2: implicitly
modify $PATH. This operation could be done directly from installation
python script (it affects on windows registry) or we could compile
simple windows native application to do this job and bundle it with bzr
installer.

Thoughts?

Well, there is one more variant: copy bzr.bat to windows system
directory (it force to have administrator privelege during install). But
it very ugly. I don't think it is good idea.

--
Alexander





More information about the bazaar mailing list