Skip to content

Commit

Permalink
Stop looking for 7z in LOCALAPPDATA.
Browse files Browse the repository at this point in the history
JuliaGizmos#177 (comment)

This commit is really just to simplify behavior and avoid another wild goose
chase in the future. It does not address recent failures on 1.0.5, which
are just because the location of the 7z.exe that's shipped with Julia
binary distributions on Windows has also changed from 1.0.4 to 1.0.5.

Really, we shouldn't be using 7z.exe at all since it's an internal Julia utility (see e.g. JuliaLang/julia#33687 and JuliaLang/julia#33862 (comment)).

This rather complex logic was introduced in
JuliaGizmos#177 for the case that 7z.exe is not in `joinpath(Sys.BINDIR, Base.LIBEXECDIR` (or its equivalent on versions prior to 1.3). Note that e.g. BinDeps, which is widely used, doesn't even go to the trouble of doing this (https://github.com/JuliaPackaging/BinDeps.jl/blob/3a871c35ef1b0f45760f48088cabd7915838b0e3/src/BinDeps.jl#L116-L120).

7z.exe should only be absent on Windows in case of a native build; it's
copied over into the build tree in the `win-extras` `make` target, which is
not a dependency of the default `make` target
(see https://github.com/JuliaLang/julia/blob/d562715a8f78627627fd0ccf3197de670efbf810/doc/build/distributing.md#windows).

The previous logic attempted to find 7z.exe in likely install locations
of binary downloads of Julia. I'm personally not convinced by the
arguments given here:
JuliaGizmos#177 (comment).

In Julia 1.3+, we should probably switch to the Artifacts system at some point, as was also done in davidanthoff/Electron.jl#49 for Electron.jl. But right now, we need a fix for Julia 1.0.5 as well.
  • Loading branch information
tkoolen committed Dec 28, 2019
1 parent 8e3c8d7 commit e576446
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions src/AtomShell/install.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,10 @@ function install()
zipper = joinpath(Sys.BINDIR, "7z.exe")
end
if !isfile(zipper)
#=
This is likely built with cygwin, which includes its own version of 7z.
But if we unzip with cmd = Cmd(`$(fwhich("bash.exe")) 7z x $file -oatom`)
The resulting files would not be windows executable.
So we want the 7z.exe included with a binary download of Julia.
The PATH environment variable likely includes to the locally built
Julia, so instead we look in the default Julia binary location and
pick the latest version.
=#

juliafolders = filter(readdir(ENV["LOCALAPPDATA"])) do f
startswith(f, "Julia-")
end
juliaversions = VersionNumber.([replace(f, "Julia-" => "") for f in juliafolders])
i = findlast(isequal(maximum(juliaversions)), juliaversions)
zipper = joinpath(ENV["LOCALAPPDATA"], juliafolders[i], "bin", "7z.exe")
if !isfile(zipper)
# we are probably in >= Julia 1.3.0, where 7z.exe is located in /libexec
zipper = joinpath(ENV["LOCALAPPDATA"], juliafolders[i], "libexec", "7z.exe")
end
isfile(zipper) || error("could not find $zipper. Try also installing a binary version of Julia.")
# Just look in the path.
zipper = "7z"
end
cmd = Cmd([zipper, "x", file, "-oatom"])
run(cmd)
run(`$zipper x $file -oatom`)
rm(file)
end

Expand Down

0 comments on commit e576446

Please sign in to comment.