You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
document() recompiles package source code, which requires a NAMESPACE #1016
Attempting to write a package wrapper around some existing source code. For reasons that are not obvious to me, calling devtools::document() starts the package recompiling. Moreover, this call fails if the package does not have a NAMESPACE file. If I start the package with a manually created NAMESPACE (even a blank one), then devtools::document() runs, recompiling everything, but then refuses to update my NAMESPACE file. Thus it appears impossible to have devtools create a NAMESPACE for the package.
Of course I can hack around this by starting with a NAMESPACE file with the comment
# Generated by roxygen2: do not edit by hand
but this feels wrong. Is there a more elegant work-around out of this catch-22? (Why does document() need to recompile anyhow?) Am I missing something?
Roxygen is a run-time documentation system - it inspects the objects in the package environment, not just the source code. That means it needs to load_all() the package, which obviously it can't do without compiling any C code.
Would you mind briefly outlining a series of steps that gets you to this point? Normally the NAMESPACE doesn't matter when compiling code.
Apologies for not having a good minimal example, this could be user error from a naive attempt to wrap a C program. Anyway, if you clone https://github.com/cboettig/rappl/tree/testing and run devtools::document() you should see the error about not having a NAMESPACE.
This seems to be related to the fact that I am using the Makefile from the original C program, which I understand isn't the right thing to do, so perhaps this isn't a problem once I figure out how to write the proper Makevars file in place of it, so perhaps this isn't a real issue. (I have a deal to learn still on that front). I was just surprised by the error.
I created it with devtools::setup() (actually copied a template created with setup()). This created a dummy NAMESPACE (that does not have the #Generated by roxygen2: header), and so Roxygen was refusing to overwrite that. So I deleted the NAMESPACE and wound up with the above error.
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/
Activity
hadley commentedon Jan 13, 2016
Roxygen is a run-time documentation system - it inspects the objects in the package environment, not just the source code. That means it needs to
load_all()the package, which obviously it can't do without compiling any C code.Would you mind briefly outlining a series of steps that gets you to this point? Normally the NAMESPACE doesn't matter when compiling code.
cboettig commentedon Jan 13, 2016
Apologies for not having a good minimal example, this could be user error from a naive attempt to wrap a C program. Anyway, if you clone https://github.com/cboettig/rappl/tree/testing and run
devtools::document()you should see the error about not having aNAMESPACE.Here's the run log I see:
This seems to be related to the fact that I am using the Makefile from the original C program, which I understand isn't the right thing to do, so perhaps this isn't a problem once I figure out how to write the proper Makevars file in place of it, so perhaps this isn't a real issue. (I have a deal to learn still on that front). I was just surprised by the error.
hadley commentedon Jan 13, 2016
How did you create the original package? Most ways should give you a dummy/empty NAMESPACE.
cboettig commentedon Jan 13, 2016
I created it with
devtools::setup()(actually copied a template created withsetup()). This created a dummy NAMESPACE (that does not have the#Generated by roxygen2:header), and so Roxygen was refusing to overwrite that. So I deleted the NAMESPACE and wound up with the above error.lock commentedon Sep 18, 2018
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/