From 708a18028f39f575339f48d3f50c818171910a98 Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Wed, 10 Jan 2018 13:16:52 -0800 Subject: [PATCH] Fix some 0.7 deprecation warnings (#346) * Fix some 0.7 deprecation warnings * Bump Compat requirement --- REQUIRE | 2 +- src/BinDeps.jl | 12 ++++++------ src/dependencies.jl | 14 +++++++------- test/runtests.jl | 6 +----- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/REQUIRE b/REQUIRE index b52a963..38bdc9a 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,4 @@ julia 0.6 URIParser SHA -Compat 0.27.0 +Compat 0.44.0 diff --git a/src/BinDeps.jl b/src/BinDeps.jl index 20da528..7cc3924 100644 --- a/src/BinDeps.jl +++ b/src/BinDeps.jl @@ -22,13 +22,13 @@ function find_library(pkg,libname,files) for filename in files dl = Libdl.dlopen_e(joinpath(Pkg.dir(),pkg,"deps","usr","lib",filename)) if dl != C_NULL - ccall(:add_library_mapping,Cint,(Ptr{Cchar},Ptr{Void}),libname,dl) + ccall(:add_library_mapping,Cint,(Ptr{Cchar},Ptr{Cvoid}),libname,dl) return true end dl = Libdl.dlopen_e(filename) if dl != C_NULL - ccall(:add_library_mapping,Cint,(Ptr{Cchar},Ptr{Void}),libname,dl) + ccall(:add_library_mapping,Cint,(Ptr{Cchar},Ptr{Cvoid}),libname,dl) return true end end @@ -138,7 +138,7 @@ mutable struct SynchronousStepCollection SynchronousStepCollection() = new(Any[],"","") end -import Base.push!, Base.run, Base.(|) +import Base: push!, run, | push!(a::SynchronousStepCollection,args...) = push!(a.steps,args...) mutable struct ChangeDirectory <: BuildStep @@ -179,7 +179,7 @@ mutable struct MakeTargets <: BuildStep targets::Vector{String} env::Dict MakeTargets(dir,target;env = Dict{AbstractString,AbstractString}()) = new(dir,target,env) - MakeTargets{S<:AbstractString}(target::Vector{S};env = Dict{AbstractString,AbstractString}()) = new("",target,env) + MakeTargets(target::Vector{<:AbstractString};env = Dict{AbstractString,AbstractString}()) = new("",target,env) MakeTargets(target::String;env = Dict{AbstractString,AbstractString}()) = new("",[target],env) MakeTargets(;env = Dict{AbstractString,AbstractString}()) = new("",String[],env) end @@ -349,7 +349,7 @@ function lower(s::ChangeDirectory,collection) end collection.cwd = s.dir end -lower(s::Void,collection) = nothing +lower(s::Nothing,collection) = nothing lower(s::Function,collection) = push!(collection,s) lower(s::CreateDirectory,collection) = @dependent_steps ( DirectoryRule(s.dest,()->(mkpath(s.dest))), ) lower(s::RemoveDirectory,collection) = @dependent_steps ( `rm -rf $(s.dest)` ) @@ -573,7 +573,7 @@ other platforms, returns `nothing`. """ function glibc_version() Compat.Sys.islinux() || return - libc = ccall(:jl_dlopen, Ptr{Void}, (Ptr{Void}, UInt32), C_NULL, 0) + libc = ccall(:jl_dlopen, Ptr{Cvoid}, (Ptr{Cvoid}, UInt32), C_NULL, 0) ptr = Libdl.dlsym_e(libc, :gnu_get_libc_version) ptr == C_NULL && return # non-glibc v = unsafe_string(ccall(ptr, Ptr{UInt8}, ())) diff --git a/src/dependencies.jl b/src/dependencies.jl index 668f0a9..0968c0e 100644 --- a/src/dependencies.jl +++ b/src/dependencies.jl @@ -371,7 +371,7 @@ function reread_sonames() have_sonames[] = false nothing else - ccall(:jl_read_sonames, Void, ()) + ccall(:jl_read_sonames, Cvoid, ()) end end @@ -612,10 +612,10 @@ function generate_steps(dep::LibraryDependency, h::Autotools, provider_opts) opts[:srcdir] = joinpath(opts[:srcdir],opts[:configure_subdir]) delete!(opts, :configure_subdir) end - unshift!(opts[:include_dirs],includedir(dep)) - unshift!(opts[:lib_dirs],libdir(dep)) - unshift!(opts[:rpath_dirs],libdir(dep)) - unshift!(opts[:pkg_config_dirs],joinpath(libdir(dep),"pkgconfig")) + pushfront!(opts[:include_dirs],includedir(dep)) + pushfront!(opts[:lib_dirs],libdir(dep)) + pushfront!(opts[:rpath_dirs],libdir(dep)) + pushfront!(opts[:pkg_config_dirs],joinpath(libdir(dep),"pkgconfig")) env = Dict{String,String}() env["PKG_CONFIG_PATH"] = join(opts[:pkg_config_dirs],":") delete!(opts,:pkg_config_dirs) @@ -649,7 +649,7 @@ function _find_library(dep::LibraryDependency; provider = Any) # Allow user to override installation path if haskey(opts,:installed_libpath) && isdir(opts[:installed_libpath]) - unshift!(paths,opts[:installed_libpath]) + pushfront!(paths,opts[:installed_libpath]) end ppaths = libdir(p,dep) @@ -711,7 +711,7 @@ end function check_path!(ret, dep, opath) flags = Libdl.RTLD_LAZY - handle = ccall(:jl_dlopen, Ptr{Void}, (Cstring, Cuint), opath, flags) + handle = ccall(:jl_dlopen, Ptr{Cvoid}, (Cstring, Cuint), opath, flags) try check_system_handle!(ret, dep, handle) finally diff --git a/test/runtests.jl b/test/runtests.jl index a8fb0b4..b239e99 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,10 +1,6 @@ using Compat +using Compat.Test, Compat.Unicode using BinDeps -if VERSION < v"0.7.0-DEV.2004" - using Base.Test -else - using Test -end Pkg.build("Cairo") # Tests apt-get code paths using Cairo