-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
absolutify --project path #28625
absolutify --project path #28625
Conversation
base/initdefs.jl
Outdated
@@ -136,10 +136,10 @@ function init_load_path() | |||
end | |||
project = (JLOptions().project != C_NULL ? | |||
unsafe_string(Base.JLOptions().project) : |
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.
This should probably be handled in init.c, for conisistency with all other options that define paths
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.
The abspath
call? Like
Lines 587 to 594 in 0846eb5
if (jl_options.outputo) | |
jl_options.outputo = abspath(jl_options.outputo, 0); | |
if (jl_options.outputji) | |
jl_options.outputji = abspath(jl_options.outputji, 0); | |
if (jl_options.outputbc) | |
jl_options.outputbc = abspath(jl_options.outputbc, 0); | |
if (jl_options.machine_file) | |
jl_options.machine_file = abspath(jl_options.machine_file, 0); |
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.
We still need the abspath
here for relative paths from JULIA_PROJECT
though.
0131a55
to
dd3e092
Compare
How did you start Julia to get this? |
base/initdefs.jl
Outdated
HOME_PROJECT[] = | ||
project == "" ? nothing : | ||
project == "@." ? current_project() : project | ||
project == "@." ? current_project() : abspath(project) |
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.
If we resolve this at startup time, you can't do --project=.
and have it follow you around. I'm not sure if resolving it at startup or having it follow you around is better.
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.
Following around to the exact pwd
is something I think you rarely want.
➜ Pkg git:(kc/free_repo) ✗ ~/julia/julia --project=.
(Pkg) pkg>
shell> cd src/
/Users/kristoffer/.julia/dev/Pkg/src
(src) pkg>
What you might want is to have the same behavior as we had before where you try to find the project based on your current path by looking in parent folders, but we wanted to write that as @..
or something?
We tried to move away from pwd
being important so I think abspath
here is definitely right.
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.
@fredrikekre could just change this to project === nothing ? nothing : abspath(project)
to fix Stefans comment?
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.
There's no way to do that from the command-line or environment, but you can accomplish it now by doing Base.HOME_PROJECT[] = "@."
to circumvent the startup time expansion and delay it until load time.
base/initdefs.jl
Outdated
@@ -136,10 +136,10 @@ function init_load_path() | |||
end | |||
project = (JLOptions().project != C_NULL ? | |||
unsafe_string(Base.JLOptions().project) : | |||
get(ENV, "JULIA_PROJECT", nothing)) | |||
get(ENV, "JULIA_PROJECT", "")) |
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.
This has a behavioral side effect: it makes setting JULIA_PROJECT
to the empty string behave the same as having it unset, which doesn't seem ideal and is something that I've generally avoided.
I agree with Kristoffer here. The reason I found this is that I made a doc-build project with needed deps, but Documenter
We can skip the |
dd3e092
to
e7b3167
Compare
e7b3167
to
c945090
Compare
I changed this to only absolutify |
b54b46a
to
fc5324d
Compare
That's not what everyone thought was the better default when I was working on that. |
Sorry, I was answering this:
Which you can still accomplish with |
No, they'd both be resolved at startup time. You'd have to do |
Not in the state the PR is now. |
I don't think that changing the way the command-line option and the environment variable behave is a great idea. That seems like it will be a huge source of confusion. |
Bump, would be nice to have this bug fixed in 1.0.1. What can we do to make progress here? |
Merge? So the problem I have with the current behaviour is that the environment I explicitly choose to start julia with is changed under my feet, by code that does not do any Pkg operations (only I guess the question is if we should do the same for |
Yes, unless we are explicit we don't want to accidentally activate random environments by changing @StefanKarpinski, do you have any issue with the current implementation? Barring comments, I will merge this in a couple of days. |
* Use projects for doc build and code coverage submission. * workaround JuliaLang/julia/pull/28625
fc5324d
to
c96025c
Compare
I added back the absolutification of |
That makes me much happier with this :) |
@@ -593,6 +593,8 @@ static void jl_resolve_sysimg_location(JL_IMAGE_SEARCH rel) | |||
jl_options.outputbc = abspath(jl_options.outputbc, 0); | |||
if (jl_options.machine_file) | |||
jl_options.machine_file = abspath(jl_options.machine_file, 0); | |||
if (jl_options.project && strncmp(jl_options.project, "@.", strlen(jl_options.project)) != 0) |
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.
can use strcmp
– this would just be a more verbose and slower way of implementing that
Fixes:
note
Pkg/Pkg
in the second path.