|
From: <bc...@wo...> - 2001-11-06 10:09:30
|
[Kevin Butler]
>> 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'?
Very good.
>>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?
Untested, but something like:
_envType = sys.registry.getProperty("python.environment", "Shell")
if _envType == "Shell":
_shellEnv = _getShellEnv()
# support environ, putenv, getenv
environ = _shellEnv.environment
putenv = environ.__setitem__
getenv = environ.__getitem__
elif _envType == "None":
...
>>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.
That's fine, for now we just need a logical place to put it, if someone
wants to add it later.
>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.
>:-)
A copy & paste into javaos.py.
># Does not:
># - read both stderror & stdin, probably in separate threads
An absolute requirement for the system() call.
># - pass changed environment to child processes started with Runtime.exec (impossible?)
An old and out of date comment?
> p = Runtime.getRuntime().exec( shellCmd, env, self._cwd )
The 3 argument version of exec() is a jdk1.3 feature. It is ok to try
and use such advanced features but there must a fallback to jdk1.1
behaviour.
I wonder if the chdir support is worth it at all. It is fine that
subshells inherit the parents (faked) notion of the $CWD but it is
confusing that files open from jython (both java and python files) does
not honor the $CWD.
>def _getOsType( os=None ):
> os = os or registry.getProperty( "python.os" ) or registry.getProperty( "os.name" )
It is better to get the os.name from the System.getProperty() method. It
is common to initialize the registry with the System.getProperties() but
it is not certain that the application embedding jython does so.
regards,
finn
|