Skip to content

Commit

Permalink
try to bypass general
Browse files Browse the repository at this point in the history
  • Loading branch information
shipengcheng1230 committed Apr 23, 2020
1 parent 3de520e commit 4e180ff
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 38 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ jobs:
# - conda update -q conda
# - conda info -a
script:
- julia --project=docs -e 'using Pkg; Pkg.instantiate(); Pkg.develop(PackageSpec(path=pwd()));'
- julia --project=docs -e 'using Pkg; Pkg.add(PackageSpec(url="https://github.com/shipengcheng1230/Gmsh_SDK_jll.jl")); Pkg.build("GmshTools")'
- julia --project=docs -e 'using Pkg; Pkg.instantiate(); Pkg.develop(PackageSpec(path=pwd())); Pkg.build("GmshTools")'
- julia --project=docs --color=yes docs/make.jl
after_success: skip
5 changes: 4 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ version = "0.4.0"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"

[compat]
MLStyle = "0.3.1"
Requires = "1.0"
julia = "1.3"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[targets]
test = ["Test"]
test = ["Test", "Pkg"]
3 changes: 0 additions & 3 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ const depsfile = joinpath(@__DIR__, "deps.jl")

const libpath = get(ENV, "GMSH_LIB_PATH", nothing)

Pkg.activate(dirname(@__DIR__))
Pkg.add(PackageSpec(url="https://github.com/shipengcheng1230/Gmsh_SDK_jll.jl"))

if libpath === nothing
open(depsfile, "w") do io
print(io,
Expand Down
47 changes: 17 additions & 30 deletions src/GmshTools.jl
Original file line number Diff line number Diff line change
@@ -1,43 +1,30 @@
module GmshTools

using MLStyle
using Requires

const depsfile = joinpath(@__DIR__, "..", "deps", "deps.jl")
if isfile(depsfile)
include(depsfile)
else
error("GmshTools is not properly installed. Please run Pkg.build(\"GmshTools\") ",
"and restart Julia.")
end
# if isfile(depsfile)
# include(depsfile)
# else
# error("GmshTools is not properly installed. Please run Pkg.build(\"GmshTools\") ",
# "and restart Julia.")
# end

function __init__()
check_deps()
end

export gmsh, @gmsh_do, @gmsh_open

macro gmsh_do(f)
quote
try
gmsh.initialize()
$(esc(f))
finally
gmsh.finalize()
end
# check_deps()
@require Gmsh_SDK_jll="4abbd9bc-5e42-58f8-a031-9aef3230cdd8" begin
isfile(depsfile) || include(joinpath(dirname(@__DIR__), "deps", "build.jl"))
include(depsfile)
end
end

macro gmsh_open(name, f)
quote
try
gmsh.initialize()
gmsh.open($(esc(name)))
$(esc(f))
finally
gmsh.finalize()
end
end
end
export
gmsh,
match_tuple,
@addField,
@gmsh_do,
@gmsh_open

include("macros.jl")

Expand Down
24 changes: 22 additions & 2 deletions src/macros.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
export match_tuple
export @addField
macro gmsh_do(f)
quote
try
gmsh.initialize()
$(esc(f))
finally
gmsh.finalize()
end
end
end

macro gmsh_open(name, f)
quote
try
gmsh.initialize()
gmsh.open($(esc(name)))
$(esc(f))
finally
gmsh.finalize()
end
end
end

"To match the tuple expression inside `begin` block and discard the rest."
match_tuple = begin
Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
using GmshTools
using Test
using Pkg

# temporary solution to bypass General registry
Pkg.add(PackageSpec(url="https://github.com/shipengcheng1230/Gmsh_SDK_jll.jl"))
using Gmsh_SDK_jll

try
gmsh.initialize()
Expand Down

2 comments on commit 4e180ff

@shipengcheng1230
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/13511

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.0 -m "<description of version>" 4e180ffb983bcec159502be28913a93d17ae6e2c
git push origin v0.4.0

Please sign in to comment.