-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Julia: replace LazyArtifacts with manual download (#227)
* Replace LazyArtifacts with a manual download * Add missing R warning * More symlink munging * Update docs * Fix argument ordering
- Loading branch information
Showing
11 changed files
with
131 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
name = "BridgeStan" | ||
uuid = "c88b6f0a-829e-4b0b-94b7-f06ab5908f5a" | ||
authors = ["Brian Ward <[email protected]>", "Bob Carpenter <[email protected]>", "Edward Roualdes <[email protected]>"] | ||
authors = [ | ||
"Brian Ward <[email protected]>", | ||
"Bob Carpenter <[email protected]>", | ||
"Edward Roualdes <[email protected]>", | ||
] | ||
version = "2.4.0" | ||
|
||
[deps] | ||
LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3" | ||
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" | ||
Inflate = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9" | ||
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76" | ||
Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" | ||
|
||
[compat] | ||
Downloads = "1" | ||
TOML = "1" | ||
Inflate = "0.1" | ||
Tar = "1" | ||
julia = "1.6" | ||
LazyArtifacts = "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Downloads, Tar, TOML, Inflate | ||
|
||
""" | ||
Windows-friendly way to get the user's home directory. | ||
""" | ||
function get_home() | ||
if Sys.iswindows() | ||
if haskey(ENV, "USERPROFILE") | ||
userhome = ENV["USERPROFILE"] | ||
elseif !haskey(ENV, "HOMEPATH") | ||
userhome = path | ||
else | ||
drive = get(ENV, "HOMEDRIVE", "") | ||
userhome = joinpath(drive, ENV["HOMEPATH"]) | ||
end | ||
return userhome | ||
else | ||
return expanduser("~/") | ||
end | ||
end | ||
|
||
function get_version() | ||
return VersionNumber( | ||
TOML.parsefile(joinpath(dirname(@__DIR__), "Project.toml"))["version"], | ||
) | ||
end | ||
const pkg_version = get_version() | ||
|
||
const HOME_BRIDGESTAN = joinpath(get_home(), ".bridgestan") | ||
const CURRENT_BRIDGESTAN = joinpath(HOME_BRIDGESTAN, "bridgestan-$pkg_version") | ||
|
||
const RETRIES = 5 | ||
|
||
|
||
function get_bridgestan_src() | ||
|
||
url = | ||
"https://github.com/roualdes/bridgestan/releases/download/" * | ||
"v$pkg_version/bridgestan-$pkg_version.tar.gz" | ||
mkpath(HOME_BRIDGESTAN) | ||
tmp = nothing | ||
err_text = "Failed to download BridgeStan $pkg_version from github.com." | ||
for i = 1:RETRIES | ||
try | ||
tmp = Downloads.download(url) | ||
break | ||
catch | ||
if i == RETRIES | ||
error(err_text) | ||
end | ||
println(err_text) | ||
println("Retrying ($(i+1)/$RETRIES)...") | ||
sleep(1) | ||
end | ||
end | ||
|
||
try | ||
tmp_extr = Tar.extract(IOBuffer(Inflate.inflate_gzip(tmp)), copy_symlinks = true) | ||
mv(joinpath(tmp_extr, "bridgestan-$pkg_version"), CURRENT_BRIDGESTAN) | ||
catch | ||
error("Failed to unpack $tmp during installation") | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.