OK, I'm getting back to environ now, integrating the feedback I received,
and testing on my Linux box.
From Chuck Clark:
> __shellExec should be _shellExec
*ouch* Sorry about that! That's what I get for making a change, then
running the tests w/o restarting the VM...
> 'sh -c "%s"' should be 'sh -c %s'
The "%s" worked for me under cygwin, honest! The no-quotes acted like it
worked, but really ignored all the arguments to the command (ls -l == ls,
etc.). Workaround is to use the exec( String[] ) form (can't use
Python's % operator *sigh*)
> Phil Surette wrote:
> The os checks were limited to Windows NT, so I went over
> to http://www.tolstoy.com/samizdat/sysprops.html
> and got a list of the os.name strings there and
> added them in along with some guesses.
Cool - thanks!
Looks like WinCE uses 'cmd' (google shows lotsa hits for WinCE and
cmd.exe together), so I'm classifying it as 'nt'.
>Under win32, os.environ should be case-insensitive,
> so I added that in as well (this follows
> cpython's behaviour). Case-sensitivity should be
> maintained for everything else (but this is untested).
Darn it, that ruins all hope of "unwrapping" the environment dictionary,
doesn't it? *sigh* Guess we could... Nope, too ugly. Functionality &
clarity trump optimization. Who ever said environment variables would be
fast? :-) :-(
Finn Bock wrote:
> A gracefull "do nothing" is needed for clasic macs.
Done.
> It must also be posible to
> override the os.name property in the registry file; something like
>
> python.os=Windows
How about 'nt|dos|mac|unix'?
>Then we need to decide how to enable this. A registry entry like
>
> python.environment=Shell
Sounds good - I'm not sure where that would hook in?
>should be the default and other values could be "None" which is what we
have
>today and maybe "Properties" which could fill the environment with just
$HOME
>and $USER and $PATH.
I didn't do anything along this line.
New code attached.
Note that we can call this whatever would be appropriate for integration
into jython (shellos?) - I'm not attached to 'environ.py' by any means.
:-)
Thanks
kb
|