-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add tempdir() to avoid unwanted package file writing #239
Conversation
The AppVeyor errors are not related to my commit; the VM cannot initialise due to a bad gateway (error 502). Probably is helps to re-run the check. |
Thanks, completely agree with your points here. Also, I completely agree with the case for making
🙏 Many thanks! |
+ updating the roxygen docs
+ linking this PR
Done. Regarding the file size, my suggestion would be something like this: sum(file.size(
list.files(
".",
recursive = TRUE,
full.names = TRUE,
all.files = FALSE
)
)) / 1000 It takes on my computer (five years old) 1.5 ms to compute and it is more realistic than the package size after the package was built, which depends too much on compiler settings. Side effect, if I do not overlook something, it would also remove the dependency to 'pkgbuild'. |
@RLumSK Thanks, these changes look great. If you'd like, I'd be happy to include the revised file-size calculation and drop the |
+ Amend guess_fileSize() in guess_other_metadata.R as proposed ropensci#239 + Update tests + Drop dependency to 'pkgbuild' + Add NEWS in NEWS.md
+ Amend guess_fileSize() in guess_other_metadata.R as proposed ropensci#239 + Update tests + Drop dependency to 'pkgbuild' + Update documentation in 'write_codemeta()' + Upddate corresponding Rd-files + Add NEWS in NEWS.md
…eanup_after_pkg_build
Done. Besides, I kept the newly set default values for |
Very nice, thanks for this! |
* Add tempdir() to avoid to writing guess_other_metadata() into the parent directory. * + swap the default + updating the roxygen docs * + Add myself as a ctb in DESCRIPTION * + mention of changes in NEWS.md + linking this PR * Address #240 and avoid pre-commit hook without user consent * Correct link in NEWS.md #240 * Modify the way the file size is calculated. + Amend guess_fileSize() in guess_other_metadata.R as proposed #239 + Update tests + Drop dependency to 'pkgbuild' + Add NEWS in NEWS.md * Modify the way the file size is calculated. + Amend guess_fileSize() in guess_other_metadata.R as proposed #239 + Update tests + Drop dependency to 'pkgbuild' + Update documentation in 'write_codemeta()' + Upddate corresponding Rd-files + Add NEWS in NEWS.md * Address #238 + Add NEWS * Update tests and add CITATION_ex2 #241
Background
Calling
create_codemeta(use_filesize = TRUE)
(the default) usespkgbuild::build()
to build the package and estimates its file size.Unfortunately, it does not clean-up after and leaves unwanted files behind in the user's home filespace (here in the parent directory). While doing so, the package violates the CRAN policy:
Solution
pkgbuild::build()
provides the argumentdest_path
. This argument can be set totempdir()
to avoid the trouble, which is the solution I propose with my PR.Further remarks
Besides it might be reasonable to make
create_codemeta(use_filesize = FALSE)
the default (not part of my PR). If a package contains a lot of code to compile it takes quite some time, and the reason for the waiting time is not immanently obvious.