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

use dirname(@__FILE__) instead of Pkg.dir #2

Merged
merged 1 commit into from
Jun 13, 2017

Conversation

tkelman
Copy link
Contributor

@tkelman tkelman commented Jun 13, 2017

this allows installing and loading the package from elsewhere

this allows installing and loading the package from elsewhere
@richardreeve
Copy link
Member

I see what you're doing, but if someone uses a different version of rcall.jl from the Phylo package that they have installed, I certainly can't guarantee it would work, so I'd be inclined to only work with the package's own rcall.jl file...

Obviously, once the dependency checking stuff works in Julia - as discussed in JuliaLang/julia#6195 - it'll just be part of the package anyway, so the problem will go away...

@tkelman
Copy link
Contributor Author

tkelman commented Jun 13, 2017

All this does is makes sure you're loading this file from a relative path to where the test file is. If you have a copy in a location outside Pkg.dir, that you add to LOAD_PATH and run the package from there, Pkg.dir is wrong and won't work.

@richardreeve
Copy link
Member

I do understand what you're doing, but I still can't offer any assurance your code will work if you use a different rcall.jl from the one that is installed with the package. I understand that I risk people using LOAD_PATH potentially getting errors, but can you see that your version will get people who have two different copies of the package folder on their computers (like me!) getting errors, as your code will access the wrong one? Anyway, isn't this really a bug in Pkg.dir(), which should return the package folder when it is provided with a package?

@@ -5,7 +5,7 @@ using Phylo
Rinstalled = false
try
using RCall
include(Pkg.dir("Phylo", "src/rcall.jl"))
include(joinpath(dirname(dirname(@__FILE__)), "src/rcall.jl"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really want me to do it this way, can you fix it to "../src/rcall.jl". Thx. It didn't error out in the tests because I have a try fallback in the tests if RCall or R isn't installed which also catches rcall.jl not being found.

@tkelman
Copy link
Contributor Author

tkelman commented Jun 13, 2017

this is using the one installed with the package. why do you think this would ever load the "wrong one" ? it will load a file from src adjacent to the test file that's running

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.

2 participants