Skip to content

Commit

Permalink
Fixdeps 0.7 (#40)
Browse files Browse the repository at this point in the history
* get rid of dep warings

* require julia 0.7-, remove Compat

Following this guide: https://discourse.julialang.org/t/updating-packages-from-julia-v0-6-to-0-7/5103

* small fixes

* update CI scripts for 0.7

* use @info macro

* remove badges of old versions

* use functions of Sys to detect OS
  • Loading branch information
scheidan authored and stevengj committed Mar 27, 2019
1 parent 38cb376 commit dacf789
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 67 deletions.
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## Documentation: http://docs.travis-ci.com/user/languages/julia/
language: julia
os:
- linux
- osx
- linux
- osx
julia:
- 0.4
- 0.5
- 0.6
- nightly
- 0.7
- 1.0
- nightly
notifications:
email: false
email: false
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[![Build Status](https://travis-ci.org/stevengj/Cubature.jl.svg?branch=master)](https://travis-ci.org/stevengj/Cubature.jl)
[![Build status](https://ci.appveyor.com/api/projects/status/bu4lciej14ct2rb0?svg=true)](https://ci.appveyor.com/project/StevenGJohnson/cubature-jl)
[![Cubature](http://pkg.julialang.org/badges/Cubature_0.4.svg)](http://pkg.julialang.org/?pkg=Cubature&ver=0.4)
[![Cubature](http://pkg.julialang.org/badges/Cubature_0.5.svg)](http://pkg.julialang.org/?pkg=Cubature&ver=0.5)
[![Cubature](http://pkg.julialang.org/badges/Cubature_0.6.svg)](http://pkg.julialang.org/?pkg=Cubature&ver=0.6)


# The Cubature module for Julia

Expand Down
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
BinDeps
julia 0.4
Compat 0.8
julia 0.7
43 changes: 18 additions & 25 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
- julia_version: 0.7
- julia_version: 1
- julia_version: nightly

platform:
- x86 # 32-bit
- x64 # 64-bit

# # Uncomment the following lines to allow failures on nightly julia
# # (tests will run but not make your overall status red)
# matrix:
# allow_failures:
# - julia_version: nightly

branches:
only:
Expand All @@ -21,24 +26,12 @@ notifications:
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
# if there's a newer build queued for the same PR, cancel this one
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"Cubature\"); Pkg.build(\"Cubature\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"Cubature\")"
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
8 changes: 4 additions & 4 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ url="https://github.com/stevengj/cubature/releases/download/v$cubvers"

tagfile = "installed_vers"
if !isfile(tagfile) || readchomp(tagfile) != "$cubvers $WORD_SIZE"
info("Installing Cubature $cubvers library...")
if is_windows()
@info "Installing Cubature $cubvers library..."
if Sys.iswindows()
run(download_cmd("$url/libcubature$WORD_SIZE-$cubvers.dll", "libcubature.dll"))
elseif is_apple()
elseif Sys.isapple()
run(download_cmd("$url/libcubature$WORD_SIZE-$cubvers.dylib", "libcubature.dylib"))
else
if !isfile("cubature-$cubvers.tar.gz")
Expand All @@ -33,5 +33,5 @@ if !isfile(tagfile) || readchomp(tagfile) != "$cubvers $WORD_SIZE"
println(f, "$cubvers $WORD_SIZE")
end
else
info("Cubature $cubvers is already installed.")
@info "Cubature $cubvers is already installed."
end
48 changes: 23 additions & 25 deletions src/Cubature.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
VERSION >= v"0.4.0-dev+6521" && __precompile__()

"""
Julia wrappers around adaptive multidimensional integration routines
from the [C Cubature Package](https://github.com/stevengj/cubature).
Expand All @@ -11,10 +9,10 @@ simple interfaces to the more basic functionality (1d and >1d
integrals of scalar functions).
"""
module Cubature
using Compat


export hcubature, pcubature, hcubature_v, pcubature_v,
hquadrature, pquadrature, hquadrature_v, pquadrature_v
hquadrature, pquadrature, hquadrature_v, pquadrature_v

const libcubature = joinpath(dirname(@__FILE__), "..", "deps", "libcubature")

Expand All @@ -29,14 +27,14 @@ const SUCCESS = convert(Int32, 0)
const FAILURE = convert(Int32, 1)

# type to distinguish cubature error codes from thrown exceptions
type NoError <: Exception end # used for integrand_error when nothing thrown
struct NoError <: Exception end # used for integrand_error when nothing thrown

@compat type IntegrandData{F}
struct IntegrandData{F}
integrand_func::F
integrand_error::Any
(::Type{IntegrandData{F}}){F}(f) = new{F}(f, NoError())
(::Type{IntegrandData{F}})(f) where F = new{F}(f, NoError())
end
IntegrandData{F}(f::F) = IntegrandData{F}(f)
IntegrandData(f::F) where F = IntegrandData{F}(f)

# C cubature code is not interrupt-safe (would leak memory), so
# use sigatomic_begin/end to defer ctrl-c handling until Julia code
Expand Down Expand Up @@ -109,13 +107,13 @@ for fscalar in (false, true) # whether the integrand is a scalar
end
end

@inline function cf{D}(f, d::D, v)
@inline function cf(f, d::D, v) where D
if v
cfunction(f, Int32,
(UInt32, UInt, Ptr{Float64}, Ref{D}, UInt32, Ptr{Float64}))
@cfunction($f, Int32,
(UInt32, UInt, Ptr{Float64}, Ref{D}, UInt32, Ptr{Float64}))
else
cfunction(f, Int32,
(UInt32, Ptr{Float64}, Ref{D}, UInt32, Ptr{Float64}))
@cfunction($f, Int32,
(UInt32, Ptr{Float64}, Ref{D}, UInt32, Ptr{Float64}))
end
end
function integrands(d, xscalar, fscalar, vectorized)
Expand All @@ -139,12 +137,12 @@ function integrands(d, xscalar, fscalar, vectorized)
end

# low-level routine, not to be called directly by user
function cubature{F}(xscalar::Bool, fscalar::Bool,
vectorized::Bool, padaptive::Bool,
fdim::Integer, f::F, # Force specialization on F
xmin_, xmax_,
reqRelError::Real, reqAbsError::Real, maxEval::Integer,
error_norm::Integer)
function cubature(xscalar::Bool, fscalar::Bool,
vectorized::Bool, padaptive::Bool,
fdim::Integer, f::F, # Force specialization on F
xmin_, xmax_,
reqRelError::Real, reqAbsError::Real, maxEval::Integer,
error_norm::Integer) where F
dim = length(xmin_)
if xscalar && dim != 1
throw(ArgumentError("quadrature routines are for 1d only"))
Expand All @@ -160,8 +158,8 @@ function cubature{F}(xscalar::Bool, fscalar::Bool,
end
xmin = Float64[xmin_...]
xmax = Float64[xmax_...]
val = Vector{Float64}(fdim)
err = Vector{Float64}(fdim)
val = Vector{Float64}(undef, fdim)
err = Vector{Float64}(undef, fdim)
d = IntegrandData(f)
fwrap = integrands(d, xscalar, fscalar, vectorized)
# ccall's first arg needs to be a constant expression, so
Expand All @@ -171,7 +169,7 @@ function cubature{F}(xscalar::Bool, fscalar::Bool,
if padaptive
if vectorized
ret = ccall((:pcubature_v,libcubature), Int32,
(UInt32, Ptr{Void}, Any,
(UInt32, Ptr{Cvoid}, Any,
UInt32, Ptr{Float64}, Ptr{Float64},
UInt, Float64, Float64, Int32,
Ptr{Float64}, Ptr{Float64}),
Expand All @@ -180,7 +178,7 @@ function cubature{F}(xscalar::Bool, fscalar::Bool,
val, err)
else
ret = ccall((:pcubature,libcubature), Int32,
(UInt32, Ptr{Void}, Any,
(UInt32, Ptr{Cvoid}, Any,
UInt32, Ptr{Float64}, Ptr{Float64},
UInt, Float64, Float64, Int32,
Ptr{Float64}, Ptr{Float64}),
Expand All @@ -191,7 +189,7 @@ function cubature{F}(xscalar::Bool, fscalar::Bool,
else
if vectorized
ret = ccall((:hcubature_v,libcubature), Int32,
(UInt32, Ptr{Void}, Any,
(UInt32, Ptr{Cvoid}, Any,
UInt32, Ptr{Float64}, Ptr{Float64},
UInt, Float64, Float64, Int32,
Ptr{Float64}, Ptr{Float64}),
Expand All @@ -200,7 +198,7 @@ function cubature{F}(xscalar::Bool, fscalar::Bool,
val, err)
else
ret = ccall((:hcubature,libcubature), Int32,
(UInt32, Ptr{Void}, Any,
(UInt32, Ptr{Cvoid}, Any,
UInt32, Ptr{Float64}, Ptr{Float64},
UInt, Float64, Float64, Int32,
Ptr{Float64}, Ptr{Float64}),
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Base.Test
using Test
using Cubature
using Compat

Expand Down

0 comments on commit dacf789

Please sign in to comment.