Generate documents for R package creation. Parameters ---------- pkg_data rpkg_data project_shortname export_string package_depends package_imports package_suggests has_wildcards Returns -------
(
pkg_data,
rpkg_data,
project_shortname,
export_string,
package_depends,
package_imports,
package_suggests,
has_wildcards,
)
| 541 | |
| 542 | # pylint: disable=R0914, R0913, R0912, R0915 |
| 543 | def generate_rpkg( |
| 544 | pkg_data, |
| 545 | rpkg_data, |
| 546 | project_shortname, |
| 547 | export_string, |
| 548 | package_depends, |
| 549 | package_imports, |
| 550 | package_suggests, |
| 551 | has_wildcards, |
| 552 | ): |
| 553 | """Generate documents for R package creation. |
| 554 | |
| 555 | Parameters |
| 556 | ---------- |
| 557 | pkg_data |
| 558 | rpkg_data |
| 559 | project_shortname |
| 560 | export_string |
| 561 | package_depends |
| 562 | package_imports |
| 563 | package_suggests |
| 564 | has_wildcards |
| 565 | |
| 566 | Returns |
| 567 | ------- |
| 568 | """ |
| 569 | # Leverage package.json to import specifics which are also applicable |
| 570 | # to R package that we're generating here, use .get in case the key |
| 571 | # does not exist in package.json |
| 572 | |
| 573 | package_name = snake_case_to_camel_case(project_shortname) |
| 574 | package_copyright = "" |
| 575 | package_rauthors = "" |
| 576 | lib_name = pkg_data.get("name") |
| 577 | |
| 578 | if rpkg_data is not None: |
| 579 | if rpkg_data.get("pkg_help_title"): |
| 580 | package_title = rpkg_data.get( |
| 581 | "pkg_help_title", pkg_data.get("description", "") |
| 582 | ) |
| 583 | if rpkg_data.get("pkg_help_description"): |
| 584 | package_description = rpkg_data.get( |
| 585 | "pkg_help_description", pkg_data.get("description", "") |
| 586 | ) |
| 587 | if rpkg_data.get("pkg_copyright"): |
| 588 | package_copyright = "\nCopyright: {}".format( |
| 589 | rpkg_data.get("pkg_copyright", "") |
| 590 | ) |
| 591 | else: |
| 592 | # fall back to using description in package.json, if present |
| 593 | package_title = pkg_data.get("description", "") |
| 594 | package_description = pkg_data.get("description", "") |
| 595 | |
| 596 | package_version = pkg_data.get("version", "0.0.1") |
| 597 | |
| 598 | # remove leading and trailing commas, add space after comma if missing |
| 599 | if package_depends: |
| 600 | package_depends = ", " + package_depends.strip(",").lstrip() |
no test coverage detected
searching dependent graphs…