From: Steve C. <St...@ig...> - 2001-12-30 16:10:33
|
For about the third time, I have spent a few hours getting the readline library worked into jython. (It happens every time I install a new jython and it changes a little bit each time.) You would think this annoying mess would get documented somewhere, but it hasn't, anywhere, correctly, in spite of several halfway attempts to do so. And much of the documentation is out of date. So please, guys, make it a New Year's resolution to get this into the official docs, somewhere. Here is a start, it worked for me: What you have to do to get Jython and Readline working (These instructions work for GNUReadline on my RedHat Linux system - your mileage may vary):=20 Note: there is another option called Editline but Bernhard Bablok, the author of gnu java_readline says he couldn't get it working, so I didn't even try. Nonetheless, Editline is the default in jython according to the source code in ReadlineConsole.java. (See item #9 below ) If this is going to be the case, then the jython docs should give more info about it or work it into the standard distribution somehow. =20 1. Download and install the javacc from http://www.webgain.com/products/java_cc/. You can't build jython without this. 2. Download the java-readline source from http://www.bablokb.de/java/readline.html 3. Make the java_readline jar and backing library using the Makefile supplied.=20 4. Deploy these into your system lib directory. (/usr/lib in my case) 5. Download the latest Jython sources from SourceForge. =20 6. Create/Modify an ant.properties file in the same directory as the build.xml for jython and add the property readline.jar giving it the value of a path to the java_readline.jar you deployed in step 3, as well as the path to javacc and any other optional jars you wish to include. 7. Build jython and deploy it. 8. Modify the jython shell script so as to precede the supplied command (java -Dpython.home=3D...) with 'LD_LIBRARY_PATH=3D"/usr/lib"' 9. Modify your registry file to add the line python.console.readlinelib=3DGnuReadline As far as I know this one isn't documented anywhere and if you don't put it in, the system tries to find Editline and throws an exception if it can't. I only pieced it together from reading the source code for jython's ReadlineConsole and for the gnu java readline. After all that, you finally have a console that recognizes the arrow keys for history when on the last line. Way too complicated. =20 So while I thank the Jython developers and Mr. Bablok for their efforts and for making this possible at all, please, someone, make this easier or at least pull all the documentation into one place. |
From: dman <ds...@ri...> - 2001-12-30 18:16:54
|
On Sun, Dec 30, 2001 at 10:10:46AM -0600, Steve Cohen wrote: | For about the third time, I have spent a few hours getting the readline | library worked into jython. ... | What you have to do to get Jython and Readline working (These | instructions work for GNUReadline on my RedHat Linux system - your | mileage may vary): ... Does it obey /etc/inputrc and ~/.inputrc for you? The debian package now includes the readline stuff (and depends on the java readline package) but it doesn't have the vi keybindings (which I have specified in both inputrc files). bash and cpython (and other programs, I am sure) obey the inputrc and give me the vi keybindings. -D -- Your beauty should not come from outward adornment, such as braided hair and the wearing of gold jewelry and fine clothes. Instead, it should be that of your inner self, the unfading beauty of a gentle and quiet spirit, which is of GREAT WORTH in God's sight. For this is the way the holy women of the past used to make themselves beautiful. I Peter 3:3-5 |
From: <bc...@wo...> - 2001-12-30 19:30:41
|
[Steve Cohen] >For about the third time, I have spent a few hours getting the readline >library worked into jython. (It happens every time I install a new >jython and it changes a little bit each time.) You would think this >annoying mess would get documented somewhere, but it hasn't, anywhere, >correctly, in spite of several halfway attempts to do so. And much of >the documentation is out of date. > >So please, guys, make it a New Year's resolution to get this into the >official docs, somewhere. Here is a start, it worked for me: > > >What you have to do to get Jython and Readline working (These >instructions work for GNUReadline on my RedHat Linux system - your >mileage may vary):=20 > >Note: there is another option called Editline but Bernhard Bablok, the >author of gnu java_readline says he couldn't get it working, so I didn't >even try. Nonetheless, Editline is the default in jython according to >the source code in ReadlineConsole.java. (See item #9 below ) If this >is going to be the case, then the jython docs should give more info >about it or work it into the standard distribution somehow. =20 > >1. Download and install the javacc from >http://www.webgain.com/products/java_cc/. You can't build jython >without this. > >2. Download the java-readline source from >http://www.bablokb.de/java/readline.html > >3. Make the java_readline jar and backing library using the Makefile >supplied.=20 > >4. Deploy these into your system lib directory. (/usr/lib in my case) > >5. Download the latest Jython sources from SourceForge. =20 > >6. Create/Modify an ant.properties file in the same directory as the >build.xml for jython and add the property readline.jar giving it the >value of a path to the java_readline.jar you deployed in step 3, as >well as the path to javacc and any other optional jars you wish to >include. > >7. Build jython and deploy it. > >8. Modify the jython shell script so as to precede the supplied command >(java -Dpython.home=3D...) with 'LD_LIBRARY_PATH=3D"/usr/lib"' > >9. Modify your registry file to add the line > > python.console.readlinelib=3DGnuReadline > >As far as I know this one isn't documented anywhere and if you don't put >it in, the system tries to find Editline and throws an exception if it >can't. I only pieced it together from reading the source code for >jython's ReadlineConsole and for the gnu java readline. I think you have made it more difficult than you have to. To enable readline you can use the binary distribution of jython-21b2, you just have to set the registry options: python.console=org.python.util.ReadlineConsole python.console.readlinelib=GnuReadline You still have to do items 2, 3, 4, 5 and 8, but I would rather not have to document how because I have truely no clue about it. The documentation for item 9 was missing, I have added a note about python.console.readlinelib to the registry.html web-page. http://www.jython.org/docs/registry.html Thank you for reporting the missing doc. >After all that, you finally have a console that recognizes the arrow >keys for history when on the last line. Way too complicated. > >So while I thank the Jython developers and Mr. Bablok for their efforts >and for making this possible at all, please, someone, make this easier >or at least pull all the documentation into one place. Sounds like a good candidate for a FAQ entry. Does anyone want to write it up? The faqwizard is read-only at the moment but send the text to the list, then I'll add it. regards, finn |