rdatsci / rtcl

R tools for the command line
65 stars 3 forks source link

rmake: option to build vignettes #57

Open surmann opened 5 years ago

surmann commented 5 years ago

Does it make sense to add an option to build vignettes? Currently, the default is no. Hence, we have to bundle the package and install it manually afterwards because rinstall works only for remote packages. Probably the alternative is to add local packages to rinstall.

What do you think?

jakob-r commented 5 years ago

well, we allow to install local packages with rinstall. However, even there you might want to have the vignette?

surmann commented 5 years ago

Using rinstall after rbuild results in an error:

> rinstall .\CornerstoneR_1.1.2-9000.tar.gz
Error: values must be length 1,
 but FUN(X[[1]]) result is length 0

rmake doesn't compile vignettes although you see the bulletpoint "** installing vignettes".

The easiest way would be to have an option to compile vignettes in rmake. An alternative is to use rinstall probably with rbuild.

jakob-r commented 5 years ago

I just tried it on your package and it worked. Can you run rinstall inside of R and send the traceback? Can it be an issue of the file path under windows?

surmann commented 5 years ago

Here is the traceback() after rinstall():

> rinstall()
> traceback()
23: doWithOneRestart(return(expr), restart)
22: withOneRestart(expr, restarts[[1L]])
21: withRestarts({
        .Internal(.signalCondition(simpleWarning(msg, call), msg, 
            call))
        .Internal(.dfltWarn(msg, call))
    }, muffleWarning = function() NULL)
20: .signalSimpleWarning("cannot remove prior installation of package 'testthat'", 
        quote(NULL))
19: warning(gettextf("cannot remove prior installation of package %s", 
        sQuote(pkgname)), domain = NA, call. = FALSE, immediate. = TRUE)
18: unpackPkgZip(foundpkgs[okp, 2L], foundpkgs[okp, 1L], lib, libs_only, 
        lock)
17: .install.winbinary(pkgs = bins, lib = lib, contriburl = contrib.url(repos, 
        type2), method = method, available = av2, destdir = destdir, 
        dependencies = NULL, libs_only = libs_only, quiet = quiet, 
        ...)
16: i.p(...)
15: force(code)
14: force(code)
13: with_envvar(c(R_PROFILE_USER = temp_rprofile), {
        force(code)
    })
12: with_rprofile_user("options(warn = 2)", i.p(...))
11: force(code)
10: with_options(list(warn = 2), with_rprofile_user("options(warn = 2)", 
        i.p(...)))
9: force(code)
8: with_envvar(c(R_LIBS = lib, R_LIBS_USER = lib, R_LIBS_SITE = lib, 
       RGL_USE_NULL = "TRUE"), if (should_error_for_warnings()) {
       with_options(list(warn = 2), with_rprofile_user("options(warn = 2)", 
           i.p(...)))
   } else {
       i.p(...)
   })
7: (function (...) 
   {
       lib <- paste(.libPaths(), collapse = .Platform$path.sep)
       if (!is_standalone() && has_package("crancache") && has_package("callr")) {
           i.p <- "crancache" %::% "install_packages"
       }
       else {
           i.p <- utils::install.packages
       }
       with_envvar(c(R_LIBS = lib, R_LIBS_USER = lib, R_LIBS_SITE = lib, 
           RGL_USE_NULL = "TRUE"), if (should_error_for_warnings()) {
           with_options(list(warn = 2), with_rprofile_user("options(warn = 2)", 
               i.p(...)))
       }
       else {
           i.p(...)
       })
   })("testthat", repos = c(CRAN = "https://cran.wu.ac.at/"), type = "both", 
       dependencies = NA, quiet = FALSE, lib = "C:/Users/surmannd/Documents/RPackages")
6: do.call(safe_install_packages, c(list(packages, repos = repos, 
       type = type, dependencies = dependencies, quiet = quiet), 
       args))
5: install_packages(object$package[object$is_cran & behind], repos = r$repos, 
       type = r$pkg_type, dependencies = dependencies, quiet = quiet, 
       ...)
4: update.package_deps(packages, dependencies = dep_deps, quiet = quiet, 
       upgrade = upgrade, build = build, build_opts = build_opts, 
       ...)
3: update(packages, dependencies = dep_deps, quiet = quiet, upgrade = upgrade, 
       build = build, build_opts = build_opts, ...)
2: remotes::install_deps(pkgdir = pkgdir, dependencies = TRUE, lib = getLibraryPath())
1: rmake()

Probably it is a path issue, but I don't think so. The current working path doesn't contain any spaces or special characters.

jakob-r commented 5 years ago

@surmann Does #59 work for you? Look at the help page of ?rt.

jakob-r commented 5 years ago

original issue solved with #59. rinstall bug in new issue #60

surmann commented 5 years ago

After our excursion we should come back to our topic. Should we add a flag to build vignettes via rmake?

jakob-r commented 5 years ago

I am just afraid that we will end up with a lot of flags that we have to pass in many places. So I prefer to just modify the build options because this gives the highest flexibility. This can now be done by editing the config file rt --config (after running rt --init) and set it e.g. to:

...
build_opts$local = c("--no-resave-data") # local sources (rmake etc.)
...

But maybe this is really cumbersome and you would just like to run rmake --buildopts 'c("--no-resave-data")'.

surmann commented 5 years ago

That's a solution for me. Thanks!

surmann commented 5 years ago

I tried it with --no-resave-data and --no-manual additionally but the vignettes are not generated via rmake.