ripl - an irb alternative - 0.3.0 released

M

Michal Suchanek

It reports a missing readline.h:
https://github.com/cldwalker/bond/blob/master/ext/readline_line_buffer/ex= tconf.rb#L13
What development files are you missing?

Did you see an extension built with the above command? If not,
debian's quirks with executables make it suspect for this as well.

I am running Debian so I need the libreadline5-dev package to get the
libreadline.so and readline headers.

The gem installs both with and without this package installed (the
versioned readline shared library is always installed as dependecy of
many packages).

When the gem is installed without the readline development package
present it installs successfully without any error reported but the
extension fails to load when used by ripl.

<no error>

# aptitude remove libreadline5-dev
The following packages will be REMOVED:
libreadline5-dev
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 811 kB will be freed.
(Reading database ... 210501 files and directories currently installed.)
Removing libreadline5-dev ...
Processing triggers for install-info ...

OptiPlex960:/home/hramrach# gem pristine bond
Restoring gem(s) to pristine condition...
Building native extensions. This could take a while...
Restored bond-0.3.4

<still no error>

# gem uninstall bond

You have requested to uninstall the gem:
bond-0.3.4
ripl-0.3.0 depends on [bond (~> 0.3.4)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]
Successfully uninstalled bond-0.3.4
OptiPlex960:/home/hramrach# gem install bond
Building native extensions. This could take a while...
Successfully installed bond-0.3.5
1 gem installed
Installing ri documentation for bond-0.3.5...
Installing RDoc documentation for bond-0.3.5...

<error loading readline_line_buffer>

# aptitude install libreadline5-dev
The following NEW packages will be installed:
libreadline5-dev
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/243 kB of archives. After unpacking 811 kB will be used.
Selecting previously deselected package libreadline5-dev.
(Reading database ... 210474 files and directories currently installed.)
Unpacking libreadline5-dev (from .../libreadline5-dev_5.2-7_amd64.deb) ...
Processing triggers for install-info ...
Setting up libreadline5-dev (5.2-7) ...
Ignoring install-info called from maintainer script
The package libreadline5-dev should be rebuilt with new debhelper to
get trigger support
Ignoring install-info called from maintainer script
The package libreadline5-dev should be rebuilt with new debhelper to
get trigger support

# gem pristine bond
Restoring gem(s) to pristine condition...
Building native extensions. This could take a while...
Restored bond-0.3.5

< no error again >


Thanks

Michal
 
G

ghorner

It reports a missing readline.h:
https://github.com/cldwalker/bond/blob/master/ext/readline_line_buffe...
What development files are you missing?
Did you see an extension built with the above command? If not,
debian's quirks with executables make it suspect for this as well.

I am running Debian so I need the libreadline5-dev package to get the
libreadline.so and readline headers.

The gem installs both with and without this package installed (the
versioned readline shared library is always installed as dependecy of
many packages).

When the gem is installed without the readline development package
present it installs successfully without any error reported but the
extension fails to load when used by ripl.

<no error>

# aptitude remove libreadline5-dev
The following packages will be REMOVED:
  libreadline5-dev
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 811 kB will be freed.
(Reading database ... 210501 files and directories currently installed.)
Removing libreadline5-dev ...
Processing triggers for install-info ...

OptiPlex960:/home/hramrach# gem pristine bond
Restoring gem(s) to pristine condition...
Building native extensions.  This could take a while...
Restored bond-0.3.4

<still no error>

# gem uninstall bond

You have requested to uninstall the gem:
        bond-0.3.4
ripl-0.3.0 depends on [bond (~> 0.3.4)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]
Successfully uninstalled bond-0.3.4
OptiPlex960:/home/hramrach# gem install bond
Building native extensions.  This could take a while...
Successfully installed bond-0.3.5
1 gem installed
Installing ri documentation for bond-0.3.5...
Installing RDoc documentation for bond-0.3.5...

<error loading readline_line_buffer>

# aptitude install libreadline5-dev
The following NEW packages will be installed:
  libreadline5-dev
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/243 kB of archives. After unpacking 811 kB will be used.
Selecting previously deselected package libreadline5-dev.
(Reading database ... 210474 files and directories currently installed.)
Unpacking libreadline5-dev (from .../libreadline5-dev_5.2-7_amd64.deb) ....
Processing triggers for install-info ...
Setting up libreadline5-dev (5.2-7) ...
Ignoring install-info called from maintainer script
The package libreadline5-dev should be rebuilt with new debhelper to
get trigger support
Ignoring install-info called from maintainer script
The package libreadline5-dev should be rebuilt with new debhelper to
get trigger support

# gem pristine bond
Restoring gem(s) to pristine condition...
Building native extensions.  This could take a while...
Restored bond-0.3.5

< no error again >

Unfortunately, none of this helps but to illustrate what you've
already said. If 5.2 is the readline version you're using, you should
consider upgrading. I'm on readline 6.1 and have only used bond with
readline >= 5.6.

What would help is to know what you get back from `find $(dirname $
(gem which bond)) | grep readline_line_buffer` . Your response didn't
mention what you got back. If you did get back a file, then try the
following install with appropriate paths for your readline:

gem install bond -- --with-readline-lib=/path/to/your/lib --with-
readline-include=/path/to/your/include

If you didn't get back a file, then I probably can't help because
debian is possibly placing it outside the gem's directory.

Gabriel
 
G

Gabriel Horner

Michal Suchanek wrote in post #973296:
As expected
/var/lib/gems/1.8/gems/bond-0.3.5/lib/readline_line_buffer.so

is present only in the case when libreadline5-dev was present while
installing the bond gem.

However, there is no difference in the dem install output.

So bond does not report any error to the user when the library is not
found, and it finds it just fine when it is installed.

Searching for the file does no help but to illustrate what I have
already seen. Bond silently installs broken extension when readline
development files are not present. Perhaps you should fail the build
when readline is not available but the Ruby interpreter does not
provide it or you should print the message to standard error rather
than standard ouput.

I'm happy to take patches if you figure out why readline.h is still =

being detected without a readline-dev package.

Did you try gem install bond -- --with-readline-lib=3D/path/to/your/lib =

--with-
readline-include=3D/path/to/your/include ?

Gabriel

-- =

Posted via http://www.ruby-forum.com/.=
 
M

Michal Suchanek

Michal Suchanek wrote in post #973296:

I'm happy to take patches if you figure out why readline.h is still
being detected without a readline-dev package.

It's not detected.

The extension is installed with thee dummy_makefile option when no
readline is found.

It's clear from the extconf file link you posted:

https://github.com/cldwalker/bond/blob/master/ext/readline_line_buffer/extc=
onf.rb

Then the extension cannot be loaded, obviously.

When gem installation succeds rubygems consumes all output so the
message you put in extconf.rb is not displayed.

With this patch installation fails when readline is not found and the
message is shown then,

Instead of false you might want to include a check for an extconf
argument (such as --without-readline) that forces instaltion of the
gem even when readline is not present and is required for the
extension to be fully functional.

--- ext/readline_line_buffer/extconf.rb.orig 1970-01-01 01:00:00.000000000 =
+0100
+++ ext/readline_line_buffer/extconf.rb 2011-01-09 12:08:52.000000000 +0100
@@ -11,9 +11,9 @@
dir_config("readline")
have_library('readline')
if !have_header('readline/readline.h')
- puts "Bond was built without readline. To use it with readline:
gem install bond" +
+ puts "Bond requires readline on this version of Ruby. To specify
readline location use:\ngem install bond" +
" -- --with-readline-dir=3D/path/to/readline"
- dummy_makefile
+ false
else
create_makefile 'readline_line_buffer'
end

Did you try gem install bond -- --with-readline-lib=3D/path/to/your/lib
--with-
readline-include=3D/path/to/your/include ?

Don't need that. Readline is detected correctly when present.

Thanks

Michal
 
G

ghorner

It's not detected.

The extension is installed with thee dummy_makefile option when no
readline is found.

It's clear from the extconf file link you posted:

https://github.com/cldwalker/bond/blob/master/ext/readline_line_buffe...

Then the extension cannot be loaded, obviously.

When gem installation succeds rubygems consumes all output so the
message you put in extconf.rb is not displayed.

With this patch installation fails when readline is not found and the
message is shown then,

Instead of false you might want to include a check for an extconf
argument (such as --without-readline) that forces instaltion of the
gem even when readline is not present and is required for the
extension to be fully functional.

--- ext/readline_line_buffer/extconf.rb.orig    1970-01-01 01:00:00.000000000 +0100
+++ ext/readline_line_buffer/extconf.rb 2011-01-09 12:08:52.000000000 +0100
@@ -11,9 +11,9 @@
   dir_config("readline")
   have_library('readline')
   if !have_header('readline/readline.h')
-    puts "Bond was built without readline. To use it with readline:
gem install bond" +
+    puts "Bond requires readline on this version of Ruby. To specify
readline location use:\ngem install bond" +
       " -- --with-readline-dir=/path/to/readline"
-    dummy_makefile
+    false
   else
     create_makefile 'readline_line_buffer'
   end

Thanks for the feedback. bond 0.4.0 comes with a --without-readline
and fails hard.
Don't need that. Readline is detected correctly when present.

So I'm guessing autocompletion works correctly with ripl for your
readline?

If it doesn't, there's a pure ruby readline you can use with ripl:

gem install ripl rb-readline -- --without-readline

Then, add to your ~/.riplrc:

Ripl.config[:readline] = 'rb-readline'
Ripl.config[:completion] = {:readline => :ruby }

Gabriel
 
M

Michal Suchanek

Thanks for the feedback. bond 0.4.0 comes with a --without-readline
and fails hard.

Yes, this now works perfectly for me.
So I'm guessing autocompletion works correctly with ripl for your
readline?

Yes, with readline autocompletion works.
If it doesn't, there's a pure ruby readline you can use with ripl:

=C2=A0 =C2=A0gem install ripl rb-readline -- --without-readline

Then, add to your ~/.riplrc:

=C2=A0 =C2=A0Ripl.config[:readline] =3D 'rb-readline'
=C2=A0 =C2=A0Ripl.config[:completion] =3D {:readline =3D> :ruby }

However, I still cannot interrupt printing of output with either
libreadline5 or rb-readline.

BTW is it possible to have both ruby completion and file completion?

They are in different places anyway. Filenames must be inside strings
and ruby must be outside strings (or inside string interpolations).

Thanks

Michal
 
G

ghorner

Thanks for the feedback. bond 0.4.0 comes with a --without-readline
and fails hard.

Yes, this now works perfectly for me.


So I'm guessing autocompletion works correctly withriplfor your
readline?

Yes, with readline autocompletion works.
Great.
If it doesn't, there's a pure ruby readline you can use withripl:
   gem installriplrb-readline -- --without-readline
Then, add to your ~/.riplrc:
   Ripl.config[:readline] = 'rb-readline'
   Ripl.config[:completion] = {:readline => :ruby }

However, I still cannot interrupt printing of output with either
libreadline5 or rb-readline.

I don't think that's a readline issue. There is ctrl-c/ Interrupt
support(https://github.com/cldwalker/ripl/blob/master/lib/ripl/
shell.rb#L57-58) but apparently it's not working for you. To debug
your problem, I would override Shell#loop_once as a plugin and try
some of these suggested ways of capturing ctrl-c:
http://stackoverflow.com/questions/2089421/capturing-ctrl-c-in-ruby
BTW is it possible to have both ruby completion and file completion?

Any completion setup you want (and setup) is possible with bond. By
default, ruby and file completion are enabled.

It works for me with C readline:

If file completion is not working, try:

What do you get back? Is this not working for C readline or rb-
readline?

Gabriel
 
M

Michal Suchanek

Thanks for the feedback. bond 0.4.0 comes with a --without-readline
and fails hard.

Yes, this now works perfectly for me.


Did you try gem install bond -- --with-readline-lib=3D/path/to/your= /lib
--with-
readline-include=3D/path/to/your/include ?
Don't need that. Readline is detected correctly when present.
So I'm guessing autocompletion works correctly withriplfor your
readline?

Yes, with readline autocompletion works.
Great.
If it doesn't, there's a pure ruby readline you can use withripl:
=C2=A0 =C2=A0gem installriplrb-readline -- --without-readline
Then, add to your ~/.riplrc:
=C2=A0 =C2=A0Ripl.config[:readline] =3D 'rb-readline'
=C2=A0 =C2=A0Ripl.config[:completion] =3D {:readline =3D> :ruby }

However, I still cannot interrupt printing of output with either
libreadline5 or rb-readline.

I don't think that's a readline issue. There is ctrl-c/ Interrupt
support(https://github.com/cldwalker/ripl/blob/master/lib/ripl/
shell.rb#L57-58) but apparently it's not working for you. To debug
your problem, I would override Shell#loop_once as a plugin and try
some of these suggested ways of capturing ctrl-c:
http://stackoverflow.com/questions/2089421/capturing-ctrl-c-in-ruby

Have you even tried?

For me it does not interrupt printing long result unless I put
something like this in shell.rb:

def puts_iter str
while str.length > 100
STDOUT << str[0...100]
str =3D str [100..-1]
end
STDOUT.puts str
end

# Prints result using #format_result
def print_result(result)
puts_iter(format_result(result)) unless @error_raised
end

BTW is it possible to have both ruby completion and file completion?

Any completion setup you want (and setup) is possible with bond. By
default, ruby and file completion are enabled.

It works for me with C readline:

=C2=A0 =C2=A0>> File.read '[TAB]

If file completion is not working, try:

=C2=A0 =C2=A0>> Bond.spy "File.read '"

What do you get back? Is this not working for C readline or rb-
readline?

Either.

It does not like to complete absolute paths:
Matches completion with condition /[\s(]["']([^'"]*)$/.
Possible completions: []
Matches for /[\s(]["']([^'"]*)$/ are [" \"/", "/"]
=3D> nil

Thanks

Michal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,295
Latest member
EmilG1510

Latest Threads

Top