Skip to content

Commit a32d9f0

Browse files
committed
Added a hook that alows MathLink to fake a working link to Mathematica when automerge is in the house.
1 parent 1ae1a63 commit a32d9f0

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name = "MathLink"
22
uuid = "18c93696-a329-5786-9845-8443133fa0b4"
3-
version = "0.4"
4-
5-
[compat]
6-
julia = "1"
3+
version = "0.4.0"
74

85
[deps]
96
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
107
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
118

9+
[compat]
10+
julia = "1"
11+
1212
[extras]
1313
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1414

deps/build.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,19 @@ function find_lib_ker()
8585
error("Could not find Mathematica or Wolfram Engine installation.\nPlease set the `JULIA_MATHLINK` and `JULIA_MATHKERNEL` variables.")
8686
end
8787

88-
mlib,mker = find_lib_ker()
8988

90-
@info "Installation found" mlib mker
89+
if get(ENV, "JULIA_REGISTRYCI_AUTOMERGE", "false") == "true"
90+
# We need to be able to install and load this package without error for
91+
# Julia's registry AutoMerge to work. Just write a fake Mathematica path.
92+
mlib = ""
93+
mker = "WolframKernel"
94+
@info "Pretending fake installation exists" mlib mker
95+
else
96+
mlib,mker = find_lib_ker()
97+
@info "Installation found" mlib mker
98+
end
99+
100+
91101

92102
open("deps.jl","w") do f
93103
println(f, "# this file is automatically generated")

src/init.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,16 @@ function refcount_dec()
3535
end
3636

3737
function __init__()
38-
# WSENV WSInitialize(WSEnvironmentParameter p)
39-
env.ptr = ccall((:MLInitialize, mlib), CEnv, (Ptr{Cvoid},), C_NULL)
40-
if env.ptr == C_NULL
41-
error("Could not initialize MathLink library")
38+
if mlib == "" ###when JULIA_REGISTRYCI_AUTOMERGE=true the mlib is an empty string, and we can test for that
39+
# We need to be able to install and load this package without error for
40+
# Julia's registry AutoMerge to work. Skip initialization of the mathlink library.
41+
@info "Pretending fake installation works"
42+
else
43+
# WSENV WSInitialize(WSEnvironmentParameter p)
44+
env.ptr = ccall((:MLInitialize, mlib), CEnv, (Ptr{Cvoid},), C_NULL)
45+
if env.ptr == C_NULL
46+
error("Could not initialize MathLink library")
47+
end
48+
atexit(refcount_dec)
4249
end
43-
atexit(refcount_dec)
4450
end

0 commit comments

Comments
 (0)