-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Fix p7zip_jll environment setup
#39155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,9 +21,51 @@ else | |
| const p7zip_exe = "7z" | ||
| end | ||
|
|
||
| # These functions look a little strange, but they're mimicking the JLLWrappers signature | ||
| p7zip(f::Function; adjust_PATH::Bool = true, adjust_LIBPATH::Bool = true) = f(p7zip_path) | ||
| p7zip(; adjust_PATH::Bool = true, adjust_LIBPATH::Bool = true) = Cmd([p7zip_path]) | ||
| if Sys.iswindows() | ||
| const LIBPATH_env = "PATH" | ||
| const LIBPATH_default = "" | ||
| const pathsep = ';' | ||
| elseif Sys.isapple() | ||
| const LIBPATH_env = "DYLD_FALLBACK_LIBRARY_PATH" | ||
| const LIBPATH_default = "~/lib:/usr/local/lib:/lib:/usr/lib" | ||
| const pathsep = ':' | ||
| else | ||
| const LIBPATH_env = "LD_LIBRARY_PATH" | ||
| const LIBPATH_default = "" | ||
| const pathsep = ':' | ||
| end | ||
|
|
||
| function adjust_ENV!(env::Dict, PATH::String, LIBPATH::String, adjust_PATH::Bool, adjust_LIBPATH::Bool) | ||
| if adjust_LIBPATH | ||
| LIBPATH_base = get(env, LIBPATH_env, expanduser(LIBPATH_default)) | ||
| if !isempty(LIBPATH_base) | ||
| env[LIBPATH_env] = string(LIBPATH, pathsep, LIBPATH_base) | ||
| else | ||
| env[LIBPATH_env] = LIBPATH | ||
| end | ||
| end | ||
| if adjust_PATH && (LIBPATH_env != "PATH" || !adjust_LIBPATH) | ||
| if adjust_PATH | ||
| if !isempty(get(env, "PATH", "")) | ||
| env["PATH"] = string(PATH, pathsep, env["PATH"]) | ||
| else | ||
| env["PATH"] = PATH | ||
| end | ||
| end | ||
| end | ||
| return env | ||
| end | ||
|
|
||
| function p7zip(f::Function; adjust_PATH::Bool = true, adjust_LIBPATH::Bool = true) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this method just be deprecated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe we can pass an appropriate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess that doesn't buy us anything over the other method. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could deprecate it, but we're in a bit of an ecosystem issue in that if a package, which uses JLLs, wants to support 1.3-1.6, they will then get deprecation warnings on 1.6 for using the older, compatible interface. I think I would rather let things be for a bit, and then start introducing deprecation warnings once we have the data showing that we have a majority of users on 1.6+, and that package devs can actually switch over without annoying too many users. |
||
| env = adjust_ENV!(copy(ENV), PATH[], LIBPATH[], adjust_PATH, adjust_LIBPATH) | ||
| withenv(env...) do | ||
| return f(p7zip_path) | ||
| end | ||
| end | ||
| function p7zip(; adjust_PATH::Bool = true, adjust_LIBPATH::Bool = true) | ||
| env = adjust_ENV!(copy(ENV), PATH[], LIBPATH[], adjust_PATH, adjust_LIBPATH) | ||
| return Cmd(Cmd([p7zip_path]); env) | ||
| end | ||
|
|
||
| function init_p7zip_path() | ||
| # Prefer our own bundled p7zip, but if we don't have one, pick it up off of the PATH | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this definition be in Base somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, probably. In v1.7 this is all going to be generated by a stdlib-vendored copy of JLLWrappers, this is all just copied from there for the interim.