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

Re-exporting non-function object (?) breaks build_site() #666

Closed
gaborcsardi opened this Issue May 15, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@gaborcsardi
Member

gaborcsardi commented May 15, 2018

This is callr, which now re-exports process from processx. If I remove the export(process) from NAMESPACE then it works fine.

❯ pkgdown::build_site()
══ Building pkgdown site ═══════════════════════════════════════════════════════
Reading from: '/Users/gaborcsardi/works/callr'
Writing to:   '/Users/gaborcsardi/works/callr/docs'
── Initialising site ───────────────────────────────────────────────────────────
Writing 'sitemap.xml'
── Building home ───────────────────────────────────────────────────────────────
Writing 'index.html'
── Building function reference ─────────────────────────────────────────────────
Warning: Topics missing from index: callr
Loading callr
Reading 'man/callr.Rd'
Reading 'man/convert_and_check_my_args.Rd'
Reading 'man/get_result.Rd'
Reading 'man/make_error.Rd'
Reading 'man/r.Rd'
Reading 'man/r_bg.Rd'
Error in asNamespace(ns) : not a namespace

❯ traceback()
28: stop("not a namespace")
27: asNamespace(ns)
26: getNamespaceName(pkg)
25: unname(getNamespaceName(pkg))
24: ns_env_name(get_env(obj))
23: href_topic_local(in_braces)
22: as_html.tag_link(.x[[i]], ...)
21: .f(.x[[i]], ...)
20: .Call(map_impl, environment(), ".x", ".f", "character")
19: purrr::map_chr(x, as_html, ...)
18: flatten_para(text, ...)
17: as_data.tag_value(.x[[i]], ...)
16: .f(.x[[i]], ...)
15: .Call(map_impl, environment(), ".x", ".f", "list")
14: purrr::map(., as_data)
13: function_list[[i]](value)
12: freduce(value, `_function_list`)
11: `_fseq`(`_lhs`)
10: eval(quote(`_fseq`(`_lhs`)), env, env)
9: eval(quote(`_fseq`(`_lhs`)), env, env)
8: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
7: sections %>% purrr::map(as_data) %>% purrr::map(add_slug)
6: data_reference_topic(topic, pkg, examples = examples, run_dont_run = run_dont_run,
       mathjax = mathjax)
5: .f(.x[[i]], ...)
4: .Call(map_impl, environment(), ".x", ".f", "list")
3: purrr::map(topics, build_reference_topic, pkg = pkg, lazy = lazy,
       examples = examples, run_dont_run = run_dont_run, mathjax = mathjax)
2: build_reference(pkg, lazy = lazy, examples = examples, run_dont_run = run_dont_run,
       mathjax = mathjax, seed = seed, override = override, preview = FALSE)
1: pkgdown::build_site()

@gaborcsardi gaborcsardi changed the title from Re-exporting non-function object (?) breaks build_ to Re-exporting non-function object (?) breaks build_site() May 15, 2018

@gaborcsardi

This comment has been minimized.

Member

gaborcsardi commented May 15, 2018

The problem is here:

package <- ns_env_name(get_env(obj))

This assumes that we are re-exporting a function, but in my case it is an object... the solution is to find where the object was imported from. This is not always easy, because we might import a whole package.... but it is not bad at least for importFrom. For that we can just look over the imports in the namespace env.

gaborcsardi added a commit that referenced this issue May 15, 2018

Fix reexportinf non-function object
We cannot take the package name from the
environment of the function in this case,
but need to look at the import env of the package.

Fixes #666.

gaborcsardi added a commit that referenced this issue May 15, 2018

Fix reexportinf non-function object
We cannot take the package name from the
environment of the function in this case,
but need to look at the import env of the package.

Fixes #666.

gaborcsardi added a commit that referenced this issue May 15, 2018

Fix reexportinf non-function object
We cannot take the package name from the
environment of the function in this case,
but need to look at the import env of the package.

Fixes #666.

gaborcsardi added a commit that referenced this issue May 15, 2018

Fix re-exporting non-function object
We cannot take the package name from the
environment of the function in this case,
but need to look at the import env of the package.

Fixes #666.

@hadley hadley closed this in #669 May 15, 2018

hadley added a commit that referenced this issue May 15, 2018

Fix re-exporting non-function object (#669)
We cannot take the package name from the
environment of the function in this case,
but need to look at the import env of the package.

Fixes #666.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment