From d51acdee8bd91e2e19c1017ab85bcac7887e776d Mon Sep 17 00:00:00 2001 From: TroyHernandez Date: Wed, 21 Oct 2026 11:05:08 -0500 Subject: [PATCH] Call utils and stats functions with their namespace `lib_path()`, `cuda_path()` and `.read_components()` called `packageName()`, `read.delim()` and `setNames()` unqualified, without importing utils or stats. With no default packages attached, as in `R_DEFAULT_PACKAGES=NULL` and the child processes of R CMD INSTALL and R CMD check, every exported path function errored with "could not find function packageName". A package that loads one of these at load time, such as torch, then fails to start under R CMD check. The calls now use `utils::` and `stats::`, both packages are declared in Imports, and sync.sh has propagated the change to every cuda* package. Fixes #5. --- cuda12.6/DESCRIPTION | 1 + cuda12.6/R/paths.R | 10 +++++----- cuda12.8/DESCRIPTION | 1 + cuda12.8/R/paths.R | 10 +++++----- cuda12.9/DESCRIPTION | 1 + cuda12.9/R/paths.R | 10 +++++----- cuda13.2/DESCRIPTION | 1 + cuda13.2/R/paths.R | 10 +++++----- shared/DESCRIPTION.template | 1 + shared/R/paths.R | 10 +++++----- 10 files changed, 30 insertions(+), 25 deletions(-) diff --git a/cuda12.6/DESCRIPTION b/cuda12.6/DESCRIPTION index dbd2a0d..7d4f7c5 100644 --- a/cuda12.6/DESCRIPTION +++ b/cuda12.6/DESCRIPTION @@ -8,6 +8,7 @@ Description: Provides CUDA 12.6 native libraries (runtime, cuBLAS, cuDNN, cuFFT, downloading pre-built binaries from PyPI at install time. Intended to be used as a dependency by packages that require CUDA 12.6. SystemRequirements: Linux or Windows; not supported on macOS. +Imports: stats, utils License: MIT + file LICENSE URL: https://github.com/mlverse/cudatoolkit BugReports: https://github.com/mlverse/cudatoolkit/issues diff --git a/cuda12.6/R/paths.R b/cuda12.6/R/paths.R index ec50eed..90edda8 100644 --- a/cuda12.6/R/paths.R +++ b/cuda12.6/R/paths.R @@ -1,8 +1,8 @@ # Read component -> wheel_subdir mapping from installed components.tsv .read_components <- function() { - tsv <- system.file("components.tsv", package = packageName(), mustWork = TRUE) - df <- read.delim(tsv, stringsAsFactors = FALSE) - setNames(df$wheel_subdir, df$component) + tsv <- system.file("components.tsv", package = utils::packageName(), mustWork = TRUE) + df <- utils::read.delim(tsv, stringsAsFactors = FALSE) + stats::setNames(df$wheel_subdir, df$component) } # Lazily cached component map @@ -27,7 +27,7 @@ #' @export cuda_path <- function(component) { system.file(file.path("nvidia", .component_subdir(component)), - package = packageName(), mustWork = TRUE) + package = utils::packageName(), mustWork = TRUE) } #' Path to the shared library directory @@ -37,7 +37,7 @@ cuda_path <- function(component) { #' @return A character string with the path to the lib directory. #' @export lib_path <- function() { - system.file("lib", package = packageName(), mustWork = TRUE) + system.file("lib", package = utils::packageName(), mustWork = TRUE) } #' Path to a CUDA component's headers diff --git a/cuda12.8/DESCRIPTION b/cuda12.8/DESCRIPTION index 4b06697..196df3d 100644 --- a/cuda12.8/DESCRIPTION +++ b/cuda12.8/DESCRIPTION @@ -8,6 +8,7 @@ Description: Provides CUDA 12.8 native libraries (runtime, cuBLAS, cuDNN, cuFFT, downloading pre-built binaries from PyPI at install time. Intended to be used as a dependency by packages that require CUDA 12.8. SystemRequirements: Linux or Windows; not supported on macOS. +Imports: stats, utils License: MIT + file LICENSE URL: https://github.com/mlverse/cudatoolkit BugReports: https://github.com/mlverse/cudatoolkit/issues diff --git a/cuda12.8/R/paths.R b/cuda12.8/R/paths.R index ec50eed..90edda8 100644 --- a/cuda12.8/R/paths.R +++ b/cuda12.8/R/paths.R @@ -1,8 +1,8 @@ # Read component -> wheel_subdir mapping from installed components.tsv .read_components <- function() { - tsv <- system.file("components.tsv", package = packageName(), mustWork = TRUE) - df <- read.delim(tsv, stringsAsFactors = FALSE) - setNames(df$wheel_subdir, df$component) + tsv <- system.file("components.tsv", package = utils::packageName(), mustWork = TRUE) + df <- utils::read.delim(tsv, stringsAsFactors = FALSE) + stats::setNames(df$wheel_subdir, df$component) } # Lazily cached component map @@ -27,7 +27,7 @@ #' @export cuda_path <- function(component) { system.file(file.path("nvidia", .component_subdir(component)), - package = packageName(), mustWork = TRUE) + package = utils::packageName(), mustWork = TRUE) } #' Path to the shared library directory @@ -37,7 +37,7 @@ cuda_path <- function(component) { #' @return A character string with the path to the lib directory. #' @export lib_path <- function() { - system.file("lib", package = packageName(), mustWork = TRUE) + system.file("lib", package = utils::packageName(), mustWork = TRUE) } #' Path to a CUDA component's headers diff --git a/cuda12.9/DESCRIPTION b/cuda12.9/DESCRIPTION index f8671ee..6322d1f 100644 --- a/cuda12.9/DESCRIPTION +++ b/cuda12.9/DESCRIPTION @@ -8,6 +8,7 @@ Description: Provides CUDA 12.9 native libraries (runtime, cuBLAS, cuDNN, cuFFT, downloading pre-built binaries from PyPI at install time. Intended to be used as a dependency by packages that require CUDA 12.9. SystemRequirements: Linux or Windows; not supported on macOS. +Imports: stats, utils License: MIT + file LICENSE URL: https://github.com/mlverse/cudatoolkit BugReports: https://github.com/mlverse/cudatoolkit/issues diff --git a/cuda12.9/R/paths.R b/cuda12.9/R/paths.R index ec50eed..90edda8 100644 --- a/cuda12.9/R/paths.R +++ b/cuda12.9/R/paths.R @@ -1,8 +1,8 @@ # Read component -> wheel_subdir mapping from installed components.tsv .read_components <- function() { - tsv <- system.file("components.tsv", package = packageName(), mustWork = TRUE) - df <- read.delim(tsv, stringsAsFactors = FALSE) - setNames(df$wheel_subdir, df$component) + tsv <- system.file("components.tsv", package = utils::packageName(), mustWork = TRUE) + df <- utils::read.delim(tsv, stringsAsFactors = FALSE) + stats::setNames(df$wheel_subdir, df$component) } # Lazily cached component map @@ -27,7 +27,7 @@ #' @export cuda_path <- function(component) { system.file(file.path("nvidia", .component_subdir(component)), - package = packageName(), mustWork = TRUE) + package = utils::packageName(), mustWork = TRUE) } #' Path to the shared library directory @@ -37,7 +37,7 @@ cuda_path <- function(component) { #' @return A character string with the path to the lib directory. #' @export lib_path <- function() { - system.file("lib", package = packageName(), mustWork = TRUE) + system.file("lib", package = utils::packageName(), mustWork = TRUE) } #' Path to a CUDA component's headers diff --git a/cuda13.2/DESCRIPTION b/cuda13.2/DESCRIPTION index 8a3f57c..528537e 100644 --- a/cuda13.2/DESCRIPTION +++ b/cuda13.2/DESCRIPTION @@ -8,6 +8,7 @@ Description: Provides CUDA 13.2 native libraries (runtime, cuBLAS, cuDNN, cuFFT, downloading pre-built binaries from PyPI at install time. Intended to be used as a dependency by packages that require CUDA 13.2. SystemRequirements: Linux or Windows; not supported on macOS. +Imports: stats, utils License: MIT + file LICENSE URL: https://github.com/mlverse/cudatoolkit BugReports: https://github.com/mlverse/cudatoolkit/issues diff --git a/cuda13.2/R/paths.R b/cuda13.2/R/paths.R index ec50eed..90edda8 100644 --- a/cuda13.2/R/paths.R +++ b/cuda13.2/R/paths.R @@ -1,8 +1,8 @@ # Read component -> wheel_subdir mapping from installed components.tsv .read_components <- function() { - tsv <- system.file("components.tsv", package = packageName(), mustWork = TRUE) - df <- read.delim(tsv, stringsAsFactors = FALSE) - setNames(df$wheel_subdir, df$component) + tsv <- system.file("components.tsv", package = utils::packageName(), mustWork = TRUE) + df <- utils::read.delim(tsv, stringsAsFactors = FALSE) + stats::setNames(df$wheel_subdir, df$component) } # Lazily cached component map @@ -27,7 +27,7 @@ #' @export cuda_path <- function(component) { system.file(file.path("nvidia", .component_subdir(component)), - package = packageName(), mustWork = TRUE) + package = utils::packageName(), mustWork = TRUE) } #' Path to the shared library directory @@ -37,7 +37,7 @@ cuda_path <- function(component) { #' @return A character string with the path to the lib directory. #' @export lib_path <- function() { - system.file("lib", package = packageName(), mustWork = TRUE) + system.file("lib", package = utils::packageName(), mustWork = TRUE) } #' Path to a CUDA component's headers diff --git a/shared/DESCRIPTION.template b/shared/DESCRIPTION.template index 0636b00..0e1cd0f 100644 --- a/shared/DESCRIPTION.template +++ b/shared/DESCRIPTION.template @@ -8,6 +8,7 @@ Description: Provides CUDA {{CUDA_MINOR}} native libraries (runtime, cuBLAS, cuD downloading pre-built binaries from PyPI at install time. Intended to be used as a dependency by packages that require CUDA {{CUDA_MINOR}}. SystemRequirements: Linux or Windows; not supported on macOS. +Imports: stats, utils License: MIT + file LICENSE URL: https://github.com/mlverse/cudatoolkit BugReports: https://github.com/mlverse/cudatoolkit/issues diff --git a/shared/R/paths.R b/shared/R/paths.R index ec50eed..90edda8 100644 --- a/shared/R/paths.R +++ b/shared/R/paths.R @@ -1,8 +1,8 @@ # Read component -> wheel_subdir mapping from installed components.tsv .read_components <- function() { - tsv <- system.file("components.tsv", package = packageName(), mustWork = TRUE) - df <- read.delim(tsv, stringsAsFactors = FALSE) - setNames(df$wheel_subdir, df$component) + tsv <- system.file("components.tsv", package = utils::packageName(), mustWork = TRUE) + df <- utils::read.delim(tsv, stringsAsFactors = FALSE) + stats::setNames(df$wheel_subdir, df$component) } # Lazily cached component map @@ -27,7 +27,7 @@ #' @export cuda_path <- function(component) { system.file(file.path("nvidia", .component_subdir(component)), - package = packageName(), mustWork = TRUE) + package = utils::packageName(), mustWork = TRUE) } #' Path to the shared library directory @@ -37,7 +37,7 @@ cuda_path <- function(component) { #' @return A character string with the path to the lib directory. #' @export lib_path <- function() { - system.file("lib", package = packageName(), mustWork = TRUE) + system.file("lib", package = utils::packageName(), mustWork = TRUE) } #' Path to a CUDA component's headers