[py-dev] Re: py.test on win32

holger krekel hpk at trillke.net
Tue May 3 21:11:01 CEST 2005


Hi Grig, 

i hope you don't mind if I finally repost to py-dev now :-) 

On Tue, May 03, 2005 at 11:12 -0700, Grig Gheorghiu wrote:
> > - python setup.py install 
> >   doesn't install any scripts (the ones in py/bin/*) 
> >   while it does that on unix/osx.  What is an approximate 
> >   way to install such cmdline scripts on win32? 
> > 
> I'm attaching a patch for py/misc/_dist.py which adds a bit of
> win32-specific functionality. It edits the "Path" registry key
> (corresponding to the PATH environment variable) and adds
> os.path.join(sysconfig.get_python_lib(), "py", "bin") to it. Then it
> propagates the changes throughout the system and also to the current
> command prompt session. As a result, you can then type:
> 
> pytest -h
> 
> and it works fine.

sounds great! 

> It's a bit strange maybe to new users that they have to type pytest
> instead of py.test. This is because pytest is actually pytest.cmd,
> which calls "python py.test <args>". One solution would be to rename
> py.test to py.test.win32 if we are on a win32 platform, then rename
> pytest.cmd to py.test.cmd, which will call "python py.test.win32". Then
> users will be able to type py.test instead of pytest. What do you
> think? 

This direction makes sense to me. What about making a subdirectory 
'py/bin/win32' which contains (possibly generated) hooks 
for win32.  For example those hooks would contain something like 

    @echo off
    python %~dp0\..\py.test %*

or - to make it fully generic - find a proper %-escape for the basename
to also work for the other scripts in py/bin/.  (That's not too important 
right now but as you may have noticed the current _dist.py mechanism
works for other py-lib style packages, too.)

> Also, please critique the patch from a code standard point of view if
> you think it doesn't fit with the rest of the code.

Looks fine, except for the bare except at the beginning :-) 

If you send me your desired account name privately, i'll set it 
up on codespeak so that you can directly commit.  I'll see 
the changes on the py-svn list and can still correct/comment on it.   

cheers, 

    holger


More information about the py-dev mailing list