Skip to content

setup.sh: drop the python3 R-source patch step (fixed upstream in #360) - #26

Merged
yannrichet-asnr merged 3 commits into
masterfrom
setup-drop-python3-dep
Aug 28, 2026
Merged

setup.sh: drop the python3 R-source patch step (fixed upstream in #360)#26
yannrichet-asnr merged 3 commits into
masterfrom
setup-drop-python3-dep

Conversation

@yannrichet

@yannrichet yannrichet commented Aug 28, 2026

Copy link
Copy Markdown
Member

Follow-up to libKriging/libKriging#360 (merged).

Background

tools/setup.sh post-processed the copied R binding sources with two inline python3 heredocs — cosmetic fixes only (an R CMD check ::: NOTE, a setOldClass startup warning, #' unlink(outfile) in examples). On a build image without python3 (e.g. rocker/r-ver), set -eo pipefail aborted setup.sh before it copied src/*.cpp and NAMESPACE; R CMD build then fell back to a default NAMESPACE, Rcpp::compileAttributes() had nothing to scan, and the package installed with zero .Call bindings — every Kriging() call failing at runtime with could not find function "new_KrigingFit". Only clean installs hit it (install_github, or a loader pinning a tag past the CRAN version).

Change

#360 moved all three tweaks into the libKriging binding sources, so there is nothing left to patch after the copy:

  • tools/setup.sh — remove both python3 heredoc blocks. src/*.cpp and NAMESPACE are now copied immediately after the R sources, so no post-copy step can abort before them.
  • remove tools/patch-r-sources.R (was the interim Rscript port; no longer needed).
  • src/libK: 6abd0dd3a52334 (libKriging master incl. #360); tools/gitmodules-shas updated to match.

Net: tools/setup.sh −71 lines, no interpreter dependency, and the bindings-less-package failure mode is gone.

(The branch has a few intermediate commits from when this PR carried the Rscript port — squash-merge for a clean history.)

🤖 Generated with Claude Code

https://claude.ai/code/session_01A5w4ZLUZpoHhtsbGyWcVtc

setup.sh tweaked the copied R binding sources (zzz.R, *KrigingClass.R)
with two inline `python3` heredocs. On a minimal build image with no
python3 (e.g. rocker/r-ver), `set -eo pipefail` made the first heredoc
abort setup.sh *before* it copied src/*.cpp and NAMESPACE. R CMD build
then wrote a default NAMESPACE and Rcpp::compileAttributes() had no
sources to scan, so the installed package shipped with zero .Call
bindings (new_KrigingFit, optim_set_*, ...). Every Kriging() call then
failed at runtime with `could not find function "new_KrigingFit"`.
Only a clean install hits this (install_github, or CRAN-version
mismatch via a loader that pins a tag); a host that already has
rlibkriging installed never re-runs setup.sh, which is why it isn't
seen on dev machines.

- Port both heredocs to tools/patch-r-sources.R. R is always present
  when building an R package, and setup.sh already shells out to
  Rscript elsewhere. Output is byte-identical to the python on the
  current zzz.R and every *KrigingClass.R.
- Copy src/*.cpp and NAMESPACE *before* the patch step, and run the
  patch with `|| echo WARNING` so a failure in this cosmetic step can
  never again yield a bindings-less package with a default NAMESPACE.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A5w4ZLUZpoHhtsbGyWcVtc
yannrichet-asnr and others added 2 commits August 28, 2026 12:51
The original python heredoc would append a second `#' unlink(outfile)` if
run over an already-patched KrigingClass.R (the inserted line itself matches
`#' .*[,(]outfile`). Skip lines that already contain `unlink(outfile)` so
re-running tools/setup.sh is a no-op -- relevant once the same fix lands in
libKriging/libKriging#360 and the source already carries the line.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A5w4ZLUZpoHhtsbGyWcVtc
…#360

libKriging/libKriging#360 moved the three tweaks (zzz.R ::: self-call,
setOldClass("WarpKriging"), unlink(outfile) in save/load.Kriging examples)
into the binding sources. With src/libK bumped to include it there is
nothing left to patch after the copy:

- remove tools/patch-r-sources.R and the patch invocation from setup.sh
- src/libK: 6abd0dd -> 3a52334 (master incl. #360), tools/gitmodules-shas
  updated to match

Net effect of this PR is now just: setup.sh no longer runs the two
python3 heredocs (or any interpreter) to post-process the copied R
sources, and src/*.cpp + NAMESPACE are copied up front so a future
post-copy step can never again abort setup.sh before them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A5w4ZLUZpoHhtsbGyWcVtc
@yannrichet yannrichet changed the title tools/setup.sh: drop python3 dependency, harden the R-source patch step setup.sh: drop the python3 R-source patch step (fixed upstream in #360) Aug 28, 2026
@yannrichet-asnr
yannrichet-asnr merged commit 4c79171 into master Aug 28, 2026
28 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants