• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JuliaLang / julia / #37728

26 Mar 2024 03:46AM UTC coverage: 80.612% (-0.8%) from 81.423%
#37728

push

local

web-flow
Update zlib to 1.3.1 (#53841)

Released January 22, 2024

69920 of 86737 relevant lines covered (80.61%)

14456248.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.22
/stdlib/p7zip_jll/src/p7zip_jll.jl
1
# This file is a part of Julia. License is MIT: https://julialang.org/license
2

3
## dummy stub for https://github.com/JuliaBinaryWrappers/p7zip_jll.jl
4
baremodule p7zip_jll
5
using Base
6

7
const PATH_list = String[]
8
const LIBPATH_list = String[]
9

10
export p7zip
11

12
# These get calculated in __init__()
13
const PATH = Ref("")
14
const LIBPATH = Ref("")
15
artifact_dir::String = ""
16
p7zip_path::String = ""
17
if Sys.iswindows()
18
    const p7zip_exe = "7z.exe"
19
else
20
    const p7zip_exe = "7z"
21
end
22

23
if Sys.iswindows()
24
    const LIBPATH_env = "PATH"
25
    const LIBPATH_default = ""
26
    const pathsep = ';'
27
elseif Sys.isapple()
28
    const LIBPATH_env = "DYLD_FALLBACK_LIBRARY_PATH"
29
    const LIBPATH_default = "~/lib:/usr/local/lib:/lib:/usr/lib"
30
    const pathsep = ':'
31
else
32
    const LIBPATH_env = "LD_LIBRARY_PATH"
33
    const LIBPATH_default = ""
34
    const pathsep = ':'
35
end
36

37
function adjust_ENV!(env::Dict{keytype(Base.EnvDict),valtype(Base.EnvDict)}, PATH::String, LIBPATH::String, adjust_PATH::Bool, adjust_LIBPATH::Bool)
74✔
38
    if adjust_LIBPATH
74✔
39
        LIBPATH_base = get(env, LIBPATH_env, expanduser(LIBPATH_default))
74✔
40
        if !isempty(LIBPATH_base)
74✔
41
            env[LIBPATH_env] = string(LIBPATH, pathsep, LIBPATH_base)
×
42
        else
43
            env[LIBPATH_env] = LIBPATH
74✔
44
        end
45
    end
46
    if adjust_PATH && (LIBPATH_env != "PATH" || !adjust_LIBPATH)
74✔
47
        if adjust_PATH
×
48
            if !isempty(get(env, "PATH", ""))
95✔
49
                env["PATH"] = string(PATH, pathsep, env["PATH"])
21✔
50
            else
51
                env["PATH"] = PATH
53✔
52
            end
53
        end
54
    end
55
    return env
74✔
56
end
57

58
function p7zip(f::Function; adjust_PATH::Bool = true, adjust_LIBPATH::Bool = true)
×
59
    env = adjust_ENV!(copy(ENV), PATH[], LIBPATH[], adjust_PATH, adjust_LIBPATH)
×
60
    withenv(env...) do
×
61
        return f(p7zip_path)
×
62
    end
63
end
64
function p7zip(; adjust_PATH::Bool = true, adjust_LIBPATH::Bool = true)
148✔
65
    env = adjust_ENV!(copy(ENV), PATH[], LIBPATH[], adjust_PATH, adjust_LIBPATH)
74✔
66
    return Cmd(Cmd([p7zip_path]); env)
74✔
67
end
68

69
function init_p7zip_path()
6✔
70
    # Prefer our own bundled p7zip, but if we don't have one, pick it up off of the PATH
71
    # If this is an in-tree build, `7z` will live in `bindir`.  Otherwise, it'll be in `private_libexecdir`
72
    for bundled_p7zip_path in (joinpath(Sys.BINDIR, Base.PRIVATE_LIBEXECDIR, p7zip_exe),
6✔
73
                               joinpath(Sys.BINDIR, p7zip_exe))
74
        if isfile(bundled_p7zip_path)
12✔
75
            global p7zip_path = abspath(bundled_p7zip_path)
6✔
76
            return
6✔
77
        end
78
    end
6✔
79
    global p7zip_path = something(Sys.which(p7zip_exe), p7zip_exe)
×
80
end
81

82
function __init__()
6✔
83
    global artifact_dir = dirname(Sys.BINDIR)
6✔
84
    init_p7zip_path()
6✔
85
    PATH[] = dirname(p7zip_path)
6✔
86
    push!(PATH_list, PATH[])
6✔
87
    append!(LIBPATH_list, [joinpath(Sys.BINDIR, Base.LIBDIR, "julia"), joinpath(Sys.BINDIR, Base.LIBDIR)])
12✔
88
    LIBPATH[] = join(LIBPATH_list, pathsep)
6✔
89
end
90

91
# JLLWrappers API compatibility shims.  Note that not all of these will really make sense.
92
# For instance, `find_artifact_dir()` won't actually be the artifact directory, because
93
# there isn't one.  It instead returns the overall Julia prefix.
94
is_available() = true
×
95
find_artifact_dir() = artifact_dir
×
96
dev_jll() = error("stdlib JLLs cannot be dev'ed")
×
97
best_wrapper = nothing
98

99
end  # module p7zip_jll
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc