Skip to content

Commit 5914610

Browse files
authored
Merge pull request #545 from ropensci/fixes_544
fixes #544
2 parents e94807e + 2396ec9 commit 5914610

File tree

5 files changed

+42
-16
lines changed

5 files changed

+42
-16
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: rix
22
Title: Reproducible Data Science Environments with 'Nix'
3-
Version: 0.17.2
3+
Version: 0.17.3
44
Authors@R: c(
55
person(given = "Bruno", family = "Rodrigues", email = "[email protected]", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0002-3211-3689")),

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# rix 0.17.3 (2025-09-30)
2+
3+
- Fixes for issue #544
4+
15
# rix 0.17.2 (2025-09-11)
26

37
- Changed the matrix channel url that was causing a NOTE and added a final

R/fetchers.R

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,19 @@ get_imports <- function(path, commit_date, ...) {
282282
# Get imports from NAMESPACE
283283
namespace_path <- gsub("DESCRIPTION", "NAMESPACE", desc_path)
284284
namespace_raw <- readLines(namespace_path)
285-
namespace_imports <- namespace_raw[grepl("importFrom", namespace_raw)]
285+
# Keep only lines that start with "import(" or "importFrom("
286+
namespace_imports <- grep(
287+
"^(import|importFrom)\\(",
288+
namespace_raw,
289+
value = TRUE
290+
)
286291

287292
if (length(namespace_imports) > 0) {
288-
# Get package names from `importFrom` statements
289-
namespace_imports_pkgs <- gsub(
290-
"importFrom\\(([^,]+).*",
291-
"\\1",
293+
# Extract the package name (first argument inside parentheses)
294+
namespace_imports_pkgs <- sub(
295+
# capture word or quoted string before first comma or closing paren
296+
'^import(?:From)?\\(([^,\\)]+).*',
297+
'\\1',
292298
namespace_imports
293299
)
294300
# Remove quotes, which is sometimes necessary
@@ -388,8 +394,11 @@ fetchgits <- function(git_pkgs, ...) {
388394
# Check if ignore_remotes_cache was passed
389395
# If not passed, ignore_remotes_cache is FALSE
390396
args <- list(...)
391-
ignore_remotes_cache <- if (!is.null(args$ignore_remotes_cache))
392-
args$ignore_remotes_cache else FALSE
397+
ignore_remotes_cache <- if (!is.null(args$ignore_remotes_cache)) {
398+
args$ignore_remotes_cache
399+
} else {
400+
FALSE
401+
}
393402

394403
if (!ignore_remotes_cache) {
395404
cache_file <- get_cache_file()
@@ -471,8 +480,11 @@ fetchzips <- function(archive_pkgs) {
471480
#' @noRd
472481
fetchpkgs <- function(git_pkgs, archive_pkgs, ...) {
473482
args <- list(...)
474-
ignore_remotes_cache <- if (!is.null(args$ignore_remotes_cache))
475-
args$ignore_remotes_cache else FALSE
483+
ignore_remotes_cache <- if (!is.null(args$ignore_remotes_cache)) {
484+
args$ignore_remotes_cache
485+
} else {
486+
FALSE
487+
}
476488

477489
# Initialize cache if git packages are present and not ignoring cache
478490
if (!is.null(git_pkgs) && !ignore_remotes_cache) {
@@ -592,11 +604,15 @@ download_all_commits <- function(repo, date) {
592604
}
593605

594606
commits <- fromJSON(rawToChar(response$content))
595-
if (!is.list(commits) || length(commits) == 0) break
607+
if (!is.list(commits) || length(commits) == 0) {
608+
break
609+
}
596610

597611
# if no commits are found, break the loop
598612
n_commits <- length(commits$sha)
599-
if (n_commits == 0) break
613+
if (n_commits == 0) {
614+
break
615+
}
600616

601617
idx <- (commit_count + 1):(commit_count + n_commits)
602618
all_commits$sha[idx] <- commits$sha
@@ -661,8 +677,11 @@ resolve_package_commit <- function(
661677

662678
# Check if ignore_remotes_cache was passed, otherwise set to FALSE
663679
args <- list(...)
664-
ignore_remotes_cache <- if (!is.null(args$ignore_remotes_cache))
665-
args$ignore_remotes_cache else FALSE
680+
ignore_remotes_cache <- if (!is.null(args$ignore_remotes_cache)) {
681+
args$ignore_remotes_cache
682+
} else {
683+
FALSE
684+
}
666685

667686
# Check if package is already in cache
668687
if (!ignore_remotes_cache) {

R/tar_nix_ga.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ tar_nix_ga <- function() {
4141
message("GitHub Actions workflow file saved to: ", path)
4242
}
4343

44-
if (identical(Sys.getenv("TESTTHAT"), "true"))
44+
if (identical(Sys.getenv("TESTTHAT"), "true")) {
4545
paste0(path, "/run-pipeline.yaml")
46+
}
4647
}

R/with_nix_helpers.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@ classify_globals <- function(globals_expr, args_vec) {
341341
pkgs = pkgs_to_attach
342342
)
343343
globs_null <- all(vapply(globs_classified, is.null, logical(1L)))
344-
if (globs_null) globs_classified <- NULL
344+
if (globs_null) {
345+
globs_classified <- NULL
346+
}
345347

346348
return(globs_classified)
347349
}

0 commit comments

Comments
 (0)