Skip to content

Commit 134f3e7

Browse files
Switch remaining julia code bool envs to get_bool_envs (JuliaLang#48383)
1 parent f8493c7 commit 134f3e7

File tree

5 files changed

+7
-14
lines changed

5 files changed

+7
-14
lines changed

base/errorshow.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -372,12 +372,9 @@ function showerror_nostdio(err, msg::AbstractString)
372372
ccall(:jl_printf, Cint, (Ptr{Cvoid},Cstring), stderr_stream, "\n")
373373
end
374374

375-
stacktrace_expand_basepaths()::Bool =
376-
tryparse(Bool, get(ENV, "JULIA_STACKTRACE_EXPAND_BASEPATHS", "false")) === true
377-
stacktrace_contract_userdir()::Bool =
378-
tryparse(Bool, get(ENV, "JULIA_STACKTRACE_CONTRACT_HOMEDIR", "true")) === true
379-
stacktrace_linebreaks()::Bool =
380-
tryparse(Bool, get(ENV, "JULIA_STACKTRACE_LINEBREAKS", "false")) === true
375+
stacktrace_expand_basepaths()::Bool = Base.get_bool_env("JULIA_STACKTRACE_EXPAND_BASEPATHS", false) === true
376+
stacktrace_contract_userdir()::Bool = Base.get_bool_env("JULIA_STACKTRACE_CONTRACT_HOMEDIR", true) === true
377+
stacktrace_linebreaks()::Bool = Base.get_bool_env("JULIA_STACKTRACE_LINEBREAKS", false) === true
381378

382379
function show_method_candidates(io::IO, ex::MethodError, @nospecialize kwargs=())
383380
is_arg_types = isa(ex.args, DataType)

contrib/generate_precompile.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const PARALLEL_PRECOMPILATION = true
2323
const debug_output = devnull # or stdout
2424

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

2929
CTRL_C = '\x03'

stdlib/LinearAlgebra/test/special.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ end
291291
@testset "concatenations of annotated types" begin
292292
N = 4
293293
# The tested annotation types
294-
testfull = Bool(parse(Int,(get(ENV, "JULIA_TESTFULL", "0"))))
294+
testfull = Base.get_bool_env("JULIA_TESTFULL", false)
295295
utriannotations = (UpperTriangular, UnitUpperTriangular)
296296
ltriannotations = (LowerTriangular, UnitLowerTriangular)
297297
triannotations = (utriannotations..., ltriannotations...)

stdlib/Profile/src/Profile.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function profile_printing_listener()
3838
while true
3939
wait(PROFILE_PRINT_COND[])
4040
peek_report[]()
41-
if get(ENV, "JULIA_PROFILE_PEEK_HEAP_SNAPSHOT", nothing) === "1"
41+
if Base.get_bool_env("JULIA_PROFILE_PEEK_HEAP_SNAPSHOT", false) === true
4242
println(stderr, "Saving heap snapshot...")
4343
fname = take_heap_snapshot()
4444
println(stderr, "Heap snapshot saved to `$(fname)`")

test/choosetests.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,7 @@ function choosetests(choices = [])
180180

181181
net_required_for = filter!(in(tests), NETWORK_REQUIRED_LIST)
182182
net_on = true
183-
JULIA_TEST_NETWORKING_AVAILABLE = get(ENV, "JULIA_TEST_NETWORKING_AVAILABLE", "") |>
184-
strip |>
185-
lowercase |>
186-
s -> tryparse(Bool, s) |>
187-
x -> x === true
183+
JULIA_TEST_NETWORKING_AVAILABLE = Base.get_bool_env("JULIA_TEST_NETWORKING_AVAILABLE", false) === true
188184
# If the `JULIA_TEST_NETWORKING_AVAILABLE` environment variable is set to `true`, we
189185
# always set `net_on` to `true`.
190186
# Otherwise, we set `net_on` to true if and only if networking is actually available.

0 commit comments

Comments
 (0)