Skip to content

Commit

Permalink
Switch remaining julia code bool envs to get_bool_envs (JuliaLang#48383)
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth authored Jan 23, 2023
1 parent f8493c7 commit 134f3e7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
9 changes: 3 additions & 6 deletions base/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,9 @@ function showerror_nostdio(err, msg::AbstractString)
ccall(:jl_printf, Cint, (Ptr{Cvoid},Cstring), stderr_stream, "\n")
end

stacktrace_expand_basepaths()::Bool =
tryparse(Bool, get(ENV, "JULIA_STACKTRACE_EXPAND_BASEPATHS", "false")) === true
stacktrace_contract_userdir()::Bool =
tryparse(Bool, get(ENV, "JULIA_STACKTRACE_CONTRACT_HOMEDIR", "true")) === true
stacktrace_linebreaks()::Bool =
tryparse(Bool, get(ENV, "JULIA_STACKTRACE_LINEBREAKS", "false")) === true
stacktrace_expand_basepaths()::Bool = Base.get_bool_env("JULIA_STACKTRACE_EXPAND_BASEPATHS", false) === true
stacktrace_contract_userdir()::Bool = Base.get_bool_env("JULIA_STACKTRACE_CONTRACT_HOMEDIR", true) === true
stacktrace_linebreaks()::Bool = Base.get_bool_env("JULIA_STACKTRACE_LINEBREAKS", false) === true

function show_method_candidates(io::IO, ex::MethodError, @nospecialize kwargs=())
is_arg_types = isa(ex.args, DataType)
Expand Down
2 changes: 1 addition & 1 deletion contrib/generate_precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const PARALLEL_PRECOMPILATION = true
const debug_output = devnull # or stdout

# Disable fancy printing
const fancyprint = (stdout isa Base.TTY) && (get(ENV, "CI", nothing) != "true")
const fancyprint = (stdout isa Base.TTY) && Base.get_bool_env("CI", false) !== true
##

CTRL_C = '\x03'
Expand Down
2 changes: 1 addition & 1 deletion stdlib/LinearAlgebra/test/special.jl
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ end
@testset "concatenations of annotated types" begin
N = 4
# The tested annotation types
testfull = Bool(parse(Int,(get(ENV, "JULIA_TESTFULL", "0"))))
testfull = Base.get_bool_env("JULIA_TESTFULL", false)
utriannotations = (UpperTriangular, UnitUpperTriangular)
ltriannotations = (LowerTriangular, UnitLowerTriangular)
triannotations = (utriannotations..., ltriannotations...)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/Profile/src/Profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function profile_printing_listener()
while true
wait(PROFILE_PRINT_COND[])
peek_report[]()
if get(ENV, "JULIA_PROFILE_PEEK_HEAP_SNAPSHOT", nothing) === "1"
if Base.get_bool_env("JULIA_PROFILE_PEEK_HEAP_SNAPSHOT", false) === true
println(stderr, "Saving heap snapshot...")
fname = take_heap_snapshot()
println(stderr, "Heap snapshot saved to `$(fname)`")
Expand Down
6 changes: 1 addition & 5 deletions test/choosetests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,7 @@ function choosetests(choices = [])

net_required_for = filter!(in(tests), NETWORK_REQUIRED_LIST)
net_on = true
JULIA_TEST_NETWORKING_AVAILABLE = get(ENV, "JULIA_TEST_NETWORKING_AVAILABLE", "") |>
strip |>
lowercase |>
s -> tryparse(Bool, s) |>
x -> x === true
JULIA_TEST_NETWORKING_AVAILABLE = Base.get_bool_env("JULIA_TEST_NETWORKING_AVAILABLE", false) === true
# If the `JULIA_TEST_NETWORKING_AVAILABLE` environment variable is set to `true`, we
# always set `net_on` to `true`.
# Otherwise, we set `net_on` to true if and only if networking is actually available.
Expand Down

0 comments on commit 134f3e7

Please sign in to comment.