Skip to content

Commit

Permalink
Merge pull request #20 from JuliaPackaging/sf/dont_adjust_twice
Browse files Browse the repository at this point in the history
Fix Windows double-adjustment of `PATH`
  • Loading branch information
giordano authored Oct 13, 2020
2 parents 422311e + 79da522 commit 141037f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "JLLWrappers"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
authors = ["Mosè Giordano", "Elliot Saba"]
version = "1.1.1"
version = "1.1.2"

[compat]
julia = "1.0.0"
Expand Down
20 changes: 13 additions & 7 deletions src/runtime.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ else
end

function adjust_ENV!(env::Dict, PATH::String, LIBPATH::String, adjust_PATH::Bool, adjust_LIBPATH::Bool)
if adjust_PATH
if !isempty(get(env, "PATH", ""))
env["PATH"] = string(PATH, pathsep, env["PATH"])
else
env["PATH"] = PATH
end
end
if adjust_LIBPATH
LIBPATH_base = get(env, LIBPATH_env, expanduser(LIBPATH_default))
if !isempty(LIBPATH_base)
Expand All @@ -29,6 +22,15 @@ function adjust_ENV!(env::Dict, PATH::String, LIBPATH::String, adjust_PATH::Bool
env[LIBPATH_env] = LIBPATH
end
end
if adjust_PATH && (LIBPATH_env != "PATH" || !adjust_LIBPATH)
if adjust_PATH
if !isempty(get(env, "PATH", ""))
env["PATH"] = string(PATH, pathsep, env["PATH"])
else
env["PATH"] = PATH
end
end
end
return env
end

Expand Down Expand Up @@ -83,6 +85,10 @@ Return the library paths that e.g. libjulia and such are stored in.
function get_julia_libpaths()
if isempty(JULIA_LIBDIRS)
append!(JULIA_LIBDIRS, [joinpath(Sys.BINDIR, Base.LIBDIR, "julia"), joinpath(Sys.BINDIR, Base.LIBDIR)])
# Windows needs to see the BINDIR as well
@static if Sys.iswindows()
push!(JULIA_LIBDIRS, Sys.BINDIR)
end
end
return JULIA_LIBDIRS
end
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,10 @@ module TestJLL end
@test isdir(@eval TestJLL OpenLibm_jll.artifact_dir)
@test isempty(@eval TestJLL OpenLibm_jll.PATH[])
@test occursin(Sys.BINDIR, @eval TestJLL OpenLibm_jll.LIBPATH[])

# Issue #20
if Sys.iswindows()
@test Sys.BINDIR JLLWrappers.get_julia_libpaths()
end
end
end

2 comments on commit 141037f

@giordano
Copy link
Member 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 created: JuliaRegistries/General/22915

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 v1.1.2 -m "<description of version>" 141037f7bbf058eee8d1fa90dbacb48a8df6f110
git push origin v1.1.2

Please sign in to comment.