|
From: Humbel O. <Otm...@bi...> - 2001-11-21 07:39:51
|
[ Finn Bock ] <snip> > Thats why I haven't touched added this feature myself. It is=20 > so easy to > get working for oneself but so hard to get it working=20 > correctly for all. <snip> > You think that is right on macs and AS/400? Maybe it actually=20 > is, but I > doubt it. I liked the old defensive comment. >=20 > >! except UnboundLocalError: > >! # 'value' is unbound because we didn't find=20 > '=3D' on first line <snip> I am willing to give the new javaos.py a try on eServer iSeries (formerly AS/400) during the next 2 weeks, but I am feeling kinda newbie concerning the os module. Therefore two questions: 1.=20 Can I take the released 2.1a2 version and just replace javaos.py, or do I have to build the current cvs snapshot ? 2. What kind of tests are you interested in mostly ? Are there any automated tests (I remember reading something about __test() but haven't any clue how to use it). Thank you for any hints. Oti. |
|
From: Humbel O. <Otm...@bi...> - 2001-11-22 14:40:17
|
[ Kevin Butler ] > The particular items that Finn was wondering about for AS/400 are the=20 > 'current directory' and 'parent directory' strings (in=20 > Unix/dos they are=20 > '.' and '..', respectively). Do you know those strings? More below. Here is a sample session, which makes me strongly believe that '.' and '..' work as expected (I also remember setting the java CLASSPATH to '.'): $ > pwd /bison/development > cd .. $ > pwd /bison $ > cd ./neighborhood neighborhood $ > pwd /bison/neighborhood $ For the rest below (snipped my original questions), I need a little more time...=20 Thank you for the tips and best wishes, Oti. > The most recent non-cvs snaphot release is 2.1a3, and that=20 > should work=20 > fine (it is what I've been using). Not sure about .1a2 and older. > There is a (rather poorly factored) __test() method, and=20 > basically, if=20 > it didn't throw an exception, it mostly worked. :-) However, it=20 > executes several 'system' commands and it really only looks=20 > at the first=20 > line of output, and doesn't check that very well... You can check=20 > visually as it prints the command it is executing, and you can see if=20 > the output makes sense for that command... (yuck) >=20 > I would expect it to fail pretty miserably on AS400 right now (and=20 > Macintosh, if anyone out there is interested in getting it=20 > working for=20 > Mac), because it only knows to execute commands with 'cmd /c=20 > COMMAND' or=20 > 'command.com /c COMMAND' or 'sh -c COMMAND', so on Mac we=20 > don't get any=20 > system/environment functionality, and on AS400 it will likely try to=20 > work like Unix, and fail. >=20 > javaos.py needs the following information for a new platform=20 > (and if you=20 > can give some earlier items w/o the later items, it can give partial=20 > functionality): >=20 > 1- how to recognize the new platform, that is, what=20 > System.getProperty(=20 > "os.name" ) returns and any variations on it, and an internal=20 > name for=20 > the platform (as400?). This is used to determine which values=20 > are used=20 > for the following items. > 2- os.curdir, os.pardir need current directory and parent directory=20 > strings ('.', and '..', respectively). > 3- os.system needs the command to "execute a command in a=20 > shell" ('sh -c'). > 4- os.environ needs os.system and the command to print out the=20 > environment as "name=3Dvalue" pairs. Also, needs to know if the=20 > environment variable names are case sensitive (unix) or=20 > insensitive (dos). >=20 > ... which reminds me that we can provide 'os.system' even if we can't=20 > get environment variables, which isn't supported by the current=20 > _ShellEnv/_NullEnv factoring... >=20 > I need to fix the default behavior - I don't think the=20 > CPython behavior=20 > (import error if no os-specific module available) is right=20 > for Jython. I=20 > think I'll convert back to the original "empty environment" as the=20 > fallback - though the additional testing/feedback provided by=20 > having it=20 > enabled is nice! :-) |
|
From: <bc...@wo...> - 2001-11-26 11:22:00
|
[Humbel Otmar] >Here is a sample session, which makes me strongly believe that '.' and >'..' work as expected (I also remember setting the java CLASSPATH to >'.'): > $ > > pwd > /bison/development > > cd .. > $ > > pwd > /bison > $ > > cd ./neighborhood > neighborhood > $ > > pwd > /bison/neighborhood > $ That's far more posix-like than I had guessed. Thanks for the feedback. regards, finn |
|
From: Kevin B. <kb...@ca...> - 2001-11-21 19:18:57
|
Humbel Otmar wrote: >I am willing to give the new javaos.py a try on eServer iSeries >(formerly AS/400) during the next 2 weeks, but I am feeling kinda newbie >concerning the os module. > Great! The particular items that Finn was wondering about for AS/400 are the 'current directory' and 'parent directory' strings (in Unix/dos they are '.' and '..', respectively). Do you know those strings? More below. > >Therefore two questions: > >1. >Can I take the released 2.1a2 version and just replace javaos.py, or do >I have to build the current cvs snapshot ? > The most recent non-cvs snaphot release is 2.1a3, and that should work fine (it is what I've been using). Not sure about .1a2 and older. > >2. >What kind of tests are you interested in mostly ? >Are there any automated tests (I remember reading something about >__test() but haven't any clue how to use it). > There is a (rather poorly factored) __test() method, and basically, if it didn't throw an exception, it mostly worked. :-) However, it executes several 'system' commands and it really only looks at the first line of output, and doesn't check that very well... You can check visually as it prints the command it is executing, and you can see if the output makes sense for that command... (yuck) I would expect it to fail pretty miserably on AS400 right now (and Macintosh, if anyone out there is interested in getting it working for Mac), because it only knows to execute commands with 'cmd /c COMMAND' or 'command.com /c COMMAND' or 'sh -c COMMAND', so on Mac we don't get any system/environment functionality, and on AS400 it will likely try to work like Unix, and fail. javaos.py needs the following information for a new platform (and if you can give some earlier items w/o the later items, it can give partial functionality): 1- how to recognize the new platform, that is, what System.getProperty( "os.name" ) returns and any variations on it, and an internal name for the platform (as400?). This is used to determine which values are used for the following items. 2- os.curdir, os.pardir need current directory and parent directory strings ('.', and '..', respectively). 3- os.system needs the command to "execute a command in a shell" ('sh -c'). 4- os.environ needs os.system and the command to print out the environment as "name=value" pairs. Also, needs to know if the environment variable names are case sensitive (unix) or insensitive (dos). ... which reminds me that we can provide 'os.system' even if we can't get environment variables, which isn't supported by the current _ShellEnv/_NullEnv factoring... I need to fix the default behavior - I don't think the CPython behavior (import error if no os-specific module available) is right for Jython. I think I'll convert back to the original "empty environment" as the fallback - though the additional testing/feedback provided by having it enabled is nice! :-) kb |