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

Consider making package load optional #771

Closed
eddelbuettel opened this issue Aug 3, 2018 · 9 comments
Closed

Consider making package load optional #771

eddelbuettel opened this issue Aug 3, 2018 · 9 comments

Comments

@eddelbuettel
Copy link
Contributor

eddelbuettel commented Aug 3, 2018

I usually call roxygenize(roclets="rd") (via this script, usually) which worked fine for many years. It uses roxygenize to translate markup from the R/ directory into content in the man/ directory. This never touches NAMESPACE or DESCRIPTION.

Now, all of a sudden, the function decides to invoke pkgload, forcing a load/build I did not ask for, and seemingly running it with different flags (as I get compiler warnings I do not get otherwise).

I would like to suppress this package loading test. Would you consider a PR to that effect? Maybe skipping if roclets is equal to "rd" so that we do not need a new flag?

(And I checked that this did not happen with version 6.0.1. The code in R/roxygenize.R appears to not have changed so this may be a side effect of other changes.)

@hadley
Copy link
Member

hadley commented Oct 23, 2018

This is an unfortunate consequence of the interaction of several packages, but should be much ameliorated with the latest version of pkgbuild, thanks to r-lib/pkgbuild@60162f8#diff-8312ad0561ef661716b48d09478362f3L1

@hadley hadley closed this as completed Oct 23, 2018
@eddelbuettel
Copy link
Contributor Author

The diff you reference appears to talk about Makefiles.

I would simply like to get back to the world where roxygenize() never ever attempts to compile (or load) a package. I call it for text substitution.

@eddelbuettel
Copy link
Contributor Author

I second the comment by @mb706, I am running into the same issue.

The bug is obviously not fixed, so I don't understand why this was closed 17 days ago.

@krlmlr
Copy link
Member

krlmlr commented Nov 10, 2018

In most cases roxygenize() needs to load the code, e.g. to create \usage{} . This has been done previously in an ad-hoc way, now pkgload takes care of this.

Seems that we need better examples for the load_code argument to roxygenize() . Maybe something like this:

env_legacy <- function(path) {
  env <- new.env(parent = ...)
  files <- dir(file.path(path, "R"), full.names = TRUE)
  for (file in files) source(file, local = env)
  env
}

roxygenise(..., load_code = env_legacy)

@eddelbuettel
Copy link
Contributor Author

Here is another manifestation of the same bug as a fresh SO question:

https://stackoverflow.com/questions/53642735/namespace-option-created-by-rcpparmadillo-package-skeleton-causes-error/

@FlorianSchwendinger
Copy link

I see something similar (R-3.5.2 + Debian + roxygen2_6.1.1)

> roxygen2::roxygenise("scs", roclets = "rd")
Loading scs
Error in getDLLRegisteredRoutines.DLLInfo(dll, addNames = FALSE) : 
  must specify DLL via aDLLInfoobject. See getLoadedDLLs()
Calls: <Anonymous> ... assignNativeRoutines -> getDLLRegisteredRoutines.DLLInfo

interestingly it seems to be connected to the useDynLib setting in the NAMESPACE file.
Using R -e 'roxygen2::roxygenise("scs", roclets = "rd")' plus

useDynLib("scs") 
export("scs", "scs_control")

does work. However changing the NAMESPACE file to

useDynLib("scs", .registration = TRUE)
export("scs", "scs_control")

then I get the error from above.

Hope this helps to narrow down the source of the issue.

dschlaep added a commit to DrylandEcology/rSFSW2 that referenced this issue Mar 11, 2019
- update `RoxygenNote` in "DESCRIPTION"
- update "README" to explain that dynamic libraries may need to first be compiled before documentation can be updated; addressing `roxygen2` issues r-lib/roxygen2#771 and r-lib/roxygen2#822
@TWilliamBell
Copy link

I believe I've encountered the same problem due to the useDynLib line not being generated in the namespace on a package using Rcpp.

@eddelbuettel
Copy link
Contributor Author

Yes -- it is very much still an open issue and regression. It bit students in my course trying to a submit a package containing a simple Rcpp function -- some were hit by this just last evening.

@Inferrator
Copy link

Issue still present in 6.1.1

@r-lib r-lib locked and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants