From 4b2fc6474ef8c374f523cecc7ae41a9196649c1e Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Wed, 22 Feb 2017 10:10:36 -0500 Subject: [PATCH 1/2] Use isdefined and Compat instead of unspecific VERSION conditions take! requires minimum version of 0.9.5 --- REQUIRE | 2 +- src/GLib/glist.jl | 2 +- test/gui.jl | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/REQUIRE b/REQUIRE index 97a041d6..2139022c 100644 --- a/REQUIRE +++ b/REQUIRE @@ -4,5 +4,5 @@ Graphics 0.1 BinDeps @windows WinRPM @osx Homebrew -Compat 0.8.0 +Compat 0.9.5 BaseTestNext diff --git a/src/GLib/glist.jl b/src/GLib/glist.jl index 305fcc59..0cca0246 100644 --- a/src/GLib/glist.jl +++ b/src/GLib/glist.jl @@ -71,7 +71,7 @@ strides(list::LList) = (1,) stride(list::LList, k::Integer) = (k > 1 ? length(list) : 1) size(list::LList) = (length(list),) isempty{L}(list::LList{L}) = (unsafe_convert(Ptr{L}, list) == C_NULL) -if VERSION > v"0.6.0-" +if isdefined(Base, :iteratorsize) Base.iteratorsize{L <: LList}(::Type{L}) = Base.HasLength() end diff --git a/test/gui.jl b/test/gui.jl index 40abafe4..b865bb71 100755 --- a/test/gui.jl +++ b/test/gui.jl @@ -3,12 +3,7 @@ using Gtk.ShortNames, Gtk.GConstants, Gtk.Graphics import Gtk.deleteat!, Gtk.libgtk_version, Gtk.GtkToolbarStyle, Gtk.GtkFileChooserAction, Gtk.GtkResponseType using Compat -if VERSION < v"0.6.0-" - take!(b::IOBuffer) = takebuf_array(b) - if VERSION < v"0.5.0-" - const String = Base.UTF8String - end -end +using Compat: String ## for FileFilter # This is just for testing, and be careful of garbage collection while using this From dea56d8854445a6b56e3bd7d65b6892630ce43c9 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Wed, 22 Feb 2017 11:22:23 -0500 Subject: [PATCH 2/2] Make it clearer that Compat.String is only needed as a takebuf_string replacement --- test/gui.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/gui.jl b/test/gui.jl index b865bb71..10ce634d 100755 --- a/test/gui.jl +++ b/test/gui.jl @@ -3,7 +3,6 @@ using Gtk.ShortNames, Gtk.GConstants, Gtk.Graphics import Gtk.deleteat!, Gtk.libgtk_version, Gtk.GtkToolbarStyle, Gtk.GtkFileChooserAction, Gtk.GtkResponseType using Compat -using Compat: String ## for FileFilter # This is just for testing, and be careful of garbage collection while using this @@ -716,13 +715,13 @@ signal_emit(c, "button-press-event", Bool, press2) pop!((c.mouse,:button1press)) signal_emit(c, "button-press-event", Bool, press1) signal_emit(c, "button-press-event", Bool, press2) -str = String(take!(io)) +str = Compat.String(take!(io)) @test str == "cb1_1\ncb2_1\ncb1_2\ncb2_1\ncb1_2\ncb2_2\ncb1_1\ncb2_2\n" c.mouse.scroll = (widget,event) -> println(io, "scrolling") scroll = Gtk.GdkEventScroll(Gtk.GdkEventType.SCROLL, Gtk.gdk_window(c), Int8(0), UInt32(0), 0.0, 0.0, UInt32(0), Gtk.GdkScrollDirection.UP, convert(Ptr{Float64},C_NULL), 0.0, 0.0, 0.0, 0.0) signal_emit(c, "scroll-event", Bool, scroll) -str = String(take!(io)) +str = Compat.String(take!(io)) @test str == "scrolling\n" destroy(w)