Re: JYTHONSTARTUP and PYTHONINSPECT

Jeff Allen <[email protected]>
Newsgroups gmane.comp.lang.jython.devel
Message-ID <[email protected]>
Footnote:

"Precedence as with other variables" isn't exactly a consistent thing 
:(, but I believe I've reconstructed the pecking order:

Source 	Filled by
postProperties 	Custom |JythonInitializer 
<eclipse-javadoc:%E2%98%82=jython-jvm9/src%3Corg.python.core%7BPySystemState.java%E2%98%83PySystemState%7EinitRegistry%7EQProperties;%7EQProperties;%7EZ%7EQString;%E2%98%82JythonInitializer>| 

preProperties 	Command-line definitions |-Dkey=value|)
... preProperties also contains ... 	Environment variables via 
|org.python.util.jython 
<eclipse-javadoc:%E2%98%82=jython-jvm9/src%3Corg.python.core%7BPySystemState.java%E2%98%83PySystemState%7EinitRegistry%7EQProperties;%7EQProperties;%7EZ%7EQString;%E2%98%82org.python.util.jython>| 

[user.home]/.jython 	User-specific registry file
[python.home]/registry 	Installation-wide registry file
Environmental inference 	e.g. |locale| command for console encoding

I believe our policy still is to recommend the registry over environment 
variables. If you go back far enough, there is *only* the registry. It 
seems tolerable for the Jython main program to respond to environment 
variables, by loading them into the registry keys as above. This makes 
our treatment of JYTHONPATH an anomaly.

PYTHONINSPECT seems necessary only so that programs themselves can set 
it. (This won't work just now, but I have an idea.)

I'm not wholly convinced by JYTHONSTARTUP, if we are trying to encourage 
use of the registry (python.startup), but I've gone for it anyway.

Jeff Allen

On 09/09/2018 00:45, Jim Baker wrote:
> +1 on both of these updates, they look good and highly useful.
>
> On Sat, Sep 8, 2018 at 12:13 PM, Jeff Allen <[email protected] 
> <mailto:[email protected]>> wrote:
>
>     I'm remodelling jython.run along the lines of CPython main for
>     clarity and conformity. CPython supports a couple of environment
>     variables it has been easy to include. They seem useful, but are
>     maybe not quite done in the Jython way. I'm not totally sure
>     whether they should be JYTHONsomething or PYTHONsomething, or be
>     registry entries instead, or as well. I'm canvassing opinions.
>
>     Historically, our policy appears to be that configuration should
>     be done via the registry (the registry files and the -D options).
>     We *always* label registry items in the style "python.some.thing".
>     We also honour some environment variables and mostly call them
>     JYTHONsomething, except there's also PYTHONWARNINGS and
>     PYTHONIOENCODING, I suppose because you want to see the same
>     values as CPython (I think).
>
>     I propose:
>
>     JYTHONSTARTUP (registry python.startup) a file to run at the start
>     of an interactive session. *J*YTHONSTARTUP because your script is
>     unlikely to be the same for CPython. Precedence as with other
>     variables.
>
>     PYTHONINSPECT (registry python.inspect) if not empty, effectively
>     sets the -i flag. (Any of these sources will *set* the flag, but
>     none can turn it off.) It's called *P*YTHONINSPECT because setting
>     it during execution should make us drop into interactive mode,
>     instead of exiting, when the first SystemExit is raised. A script
>     that does so may not be aware it's in Jython, so I favour the
>     standard Python name.
>
>     Jeff
>
>     -- 
>
>     Jeff Allen
>
>
>
>     _______________________________________________
>     Jython-dev mailing list
>     [email protected]
>     <mailto:[email protected]>
>     https://lists.sourceforge.net/lists/listinfo/jython-dev
>     <https://lists.sourceforge.net/lists/listinfo/jython-dev>
>
>

_______________________________________________
Jython-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.