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

Loading package fails on setOldClass #568

Closed
renozao opened this issue Jan 27, 2017 · 11 comments
Closed

Loading package fails on setOldClass #568

renozao opened this issue Jan 27, 2017 · 11 comments
Labels

Comments

@renozao
Copy link

@renozao renozao commented Jan 27, 2017

For the record only, because I realized that things works fine with devtools::document.

If the package to document contains a call to setOldClass, then roxygenise fails with the following error:

Loading required package: roxygen_devtest
Error in .requirePackage(package) : 
  unable to find required packageroxygen_devtestIn addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package calledroxygen_devtest

traceback shows:

13: stop(gettextf("unable to find required package %s", sQuote(package)), 
        domain = NA)
12: .requirePackage(package)
11: makeExtends(name, what, slots = slots, classDef2 = whatClassDef, 
        package = package)
10: makeClassRepresentation(Class, properties, superClasses, prototype, 
        package, validity, access, version, sealed, where = where)
9: setClass(cl, contains = c(prevClass, "VIRTUAL"), where = where)
8: setOldClass("A")
7: eval(expr, envir, enclos)
6: eval(expr, envir = envir)
5: FUN(X[[i]], ...)
4: lapply(paths, sys_source, envir = env, fileEncoding = desc$Encoding %||% 
       "UTF-8")
3: load_code(base_path)
2: parse_package(base_path, load_code, registry, options)
1: roxygen2::roxygenise("~/projects/tmp/A")
@jpritikin
Copy link

@jpritikin jpritikin commented Feb 1, 2017

Hm, so until this is fixed, the workaround is to use devtools::document? But I definitely don't want to wait for all the C++ source code to compile. Is there some other way to persuade roxygen2::roxygenise to work?

nealrichardson pushed a commit to Crunch-io/rcrunch that referenced this issue Feb 2, 2017
@ghost
Copy link

@ghost ghost commented Feb 4, 2017

FWIW: I'm also seeing this problem when I try build my NAMESPACE. The method I use is

echo "library(roxygen2); roxygenize('.')" | R --slave

Which worked just fine with 5.x.x, but now breaks with the error that was reported above (cannot find roxygen_devtest)

@jpritikin
Copy link

@jpritikin jpritikin commented Feb 8, 2017

Can we get some kind of estimate of when this might be fixed? Is it a big problem requiring lots of substantial development or, potentially, a 1 line fix?

@GuangchuangYu
Copy link

@GuangchuangYu GuangchuangYu commented Feb 15, 2017

have similar issue here.

It works when I re-install old version (5.0.1).

@jpritikin
Copy link

@jpritikin jpritikin commented Feb 16, 2017

Hm, I was using the old class packageVersion. I guess it is simple enough to apply as.character and pacakge_version as needed to avoid storing this class in an object.

HenrikBengtsson added a commit to HenrikBengtsson/BiocParallel.FutureParam that referenced this issue Feb 19, 2017
@alejandro-sotolongo
Copy link

@alejandro-sotolongo alejandro-sotolongo commented Mar 4, 2017

I noticed this problem too when my package had other (non-related) errors that prevented it from being built. After correcting the other errors and rebuilding the package roxygenize worked fine.

@bbolker
Copy link

@bbolker bbolker commented Apr 9, 2017

Still having this with latest (as of today) version from GitHub installed,

The devtools::document() workaround works for me.

Error in .requirePackage(package) : 
  unable to find required package ‘roxygen_devtest’
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘roxygen_devtest’
> roxygenise("Rpkg")
Loading required package: roxygen_devtest
Error in .requirePackage(package) : 
  unable to find required package ‘roxygen_devtest’
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘roxygen_devtest’
> traceback()
12: stop(gettextf("unable to find required package %s", sQuote(package)), 
        domain = NA)
11: .requirePackage(package)
10: makeExtends(name, what, slots = slots, classDef2 = whatClassDef, 
        package = package)
9: makeClassRepresentation(Class, properties, contains, prototype, 
       package, validity, access, version, sealed, where = where)
8: setClass("TransformedModel", contains = "Model", slots = c(transforms = "list", 
       inverses = "list"))
7: eval(expr, envir = envir)
6: eval(expr, envir = envir)
5: FUN(X[[i]], ...)
4: lapply(paths, sys_source, envir = env, fileEncoding = desc$Encoding %||% 
       "UTF-8")
3: load_code(base_path)
2: parse_package(base_path, load_code, registry, options)
1: roxygenise("Rpkg")

@hadley
Copy link
Member

@hadley hadley commented Aug 16, 2017

We should be able to fix this now that the package loading simulation has been extracted out of devtools and into pkgload. However, in general, there is no way to avoid recompiling code because you may be documenting C++ functions.

@hadley hadley added the feature label Aug 16, 2017
@hadley hadley closed this in bd0875c Aug 17, 2017
@jpritikin
Copy link

@jpritikin jpritikin commented Aug 17, 2017

However, in general, there is no way to avoid recompiling code because you may be documenting C++ functions.

That's disappointing. Is there some way to invoke roxygen2 to tell it that we don't care about C++ functions and compilation can be skipped?

@hadley
Copy link
Member

@hadley hadley commented Aug 17, 2017

I don't understand why it's a problem because you only need to recompile when the C++ code changes.

@jpritikin
Copy link

@jpritikin jpritikin commented Aug 17, 2017

Oh! That is an improvement. I'll let you know how things go.

yihui added a commit to yihui/Rd2roxygen that referenced this issue Aug 2, 2018
…o import/export objects from base R, which is because getNamespaceExports(pkg) will return wrong objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants