-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add ability to load packages from any library directory #56
Comments
I'd like to include this, but the checks failed, seemingly for an unrelated reason. Pushing a new commit seems like the only way to retrigger checks after some changes by GitHub. If we can get the checks to pass on all platforms I'm in favour of merging this into master with an eye to including in the next release. |
Fix looks great, currently in https://github.com/torfason/import/tree/prx/awong234-getNamespaceExports pretty ready to merge into dev. |
This has been merged into |
Dang, @awong234, I just found that this fix (c5b503b) breaks ── Failure (test_import.R:51:5): test_basetemplate.R works ────────────────────
\[1\] "[...]import\.Rcheck/tests/test_import"
── Error \(\?\?\?\): Basic scenario works ───────────────────────────────────────────
Error: there is no package called ‘knitr’
Backtrace:
1\. testthat::expect_silent\(import::from\(knitr, normal_print\)\)
9\. import::from\(knitr, normal_print\)
10\. base::tryCatch\(\.\.\.\)
11\. base tryCatchList\(expr, classes, parentenv, handlers\)
12\. base tryCatchOne\(expr, names, parentenv, handlers\[\[1L\]\]\)
13\. value\[\[3L\]\]\(cond\) Do you have any idea what might be going on? |
Hi Magnus. I took a look yesterday but I couldn't figure out what's wrong. I'll keep investigating to see why this is occurring, thanks! |
Sounds good. One question, just out of curiosity, were you able reproduce to this but not figure out what's wrong, or were you unable to reproduce it? |
The former -- I ran |
@awong234, an idea came to me, which was to change the default value of
This seems to fix the issue, and it "feels right" to me to make this change coupled with the change of order of operations in your original pull request. However, this had already been discussed and decided against in 2015 (see #10), which makes me reluctant to pull it in with other changes last minute before release. So what I propose is to do the release now based on what is in |
Hi Magnus, I think I've narrowed the issue, after debugging Debugging the error inside
|
No, thank you! For this incredible detective work! And I could not be less sorry that you documented it so well! I think it is especially neat that you figured out how things manage to load using the old order, and that the loading is actually silently using And I agree with your conclusion that the correct fix is to use the "revised order", that is I think the way forward is clear, but since people are waiting for specific functionality that |
This has now been fixed in Installations from GitHub, using |
This large fix is now included in the released version on CRAN, specifially in the |
Assuming 'lib' is a directory that is not defined in the
.libPaths()
, and packagefoo
exists in 'lib', and functionbar
exists in foo, I expect:To import function
bar
fromfoo
. At the moment this causes an error, due togetNamespaceExports
being called before the namespace offoo
is made available. The solution appears to be a quick reordering of the operations, asloadNamespace
comes right after that, and since that uses the.library
parameter it can successfully load the namespace forgetNamespaceExports
to reference.Open PR in #55
Workaround currently is to explicitly add
lib
to the.libPaths
The text was updated successfully, but these errors were encountered: