Skip to content
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

store the path to where a package got loaded #37586

Merged
merged 1 commit into from
Sep 16, 2020
Merged

Conversation

KristofferC
Copy link
Member

And use it in pkgdir

Fixes #33210

@timholy
Copy link
Member

timholy commented Sep 15, 2020

So cool! Is #35663 next?

@KristofferC
Copy link
Member Author

What behavior do you want there? A warning when the package would have gotten loaded from a different place than if it was not already loaded?

@timholy
Copy link
Member

timholy commented Sep 15, 2020

Personally, I want an error---don't let the user change environments.

@KristofferC KristofferC merged commit 3028ade into master Sep 16, 2020
@KristofferC KristofferC deleted the kc/pkgpaths branch September 16, 2020 07:36
@KristofferC
Copy link
Member Author

KristofferC commented Sep 16, 2020

Storing the path here is an improvement but it isn't really perfect. For example, if I make a sysimage, send it to a friend and they uses it, loads the same version of a package that is in the sysimage, that will have a different computed path where that package would be loaded from, but it is still the same package version. What we should store is probably more akin to "how this package got loaded". And there are a few ways a package can get loaded:

  • by git-tree-sha1
  • by explicit path
  • by implicit path due to the folder being in LOAD_PATH (how stdlibs are loaded).

In the case above, the same git-tree-sha1 would be used so even if the absolute paths are resolved differently, it is still not a problem.

@timholy
Copy link
Member

timholy commented Sep 16, 2020

Seems like this must have missed a case:

julia> using JuliaInterpreter

julia> pathof(JuliaInterpreter)
"/home/tim/.julia/packages/JuliaInterpreter/muncv/src/JuliaInterpreter.jl"

julia> exit()
tim@diva:~/.julia/dev/Revise$ julia-master --startup-file=no -q
julia> using Revise

julia> using JuliaInterpreter

julia> pathof(JuliaInterpreter)

julia>

@KristofferC
Copy link
Member Author

Thanks, will look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pathof(::Module) doesn't show the path where the module actually got imported from
2 participants