Skip to content

Commit 3544f7a

Browse files
committed
support python 3.10 from registry
1 parent 5422e46 commit 3544f7a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

R/config.R

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ py_discover_config <- function(required_module = NULL, use_environment = NULL) {
324324

325325
# provide other common locations
326326
python_versions <- c(python_versions, py_discover_config_fallbacks())
327-
327+
328328
# next add all known virtual environments
329329
python_versions <- c(python_versions, python_envs$python)
330330

@@ -349,14 +349,14 @@ py_discover_config <- function(required_module = NULL, use_environment = NULL) {
349349

350350
# get the config
351351
config <- python_config(python_version, required_module, python_versions)
352-
352+
353353
# if this is a conda python installation, then create an r-reticulate
354354
# environment and use that instead
355355
initenv <-
356356
identical(getOption("reticulate.conda.autoclone", FALSE), TRUE) &&
357357
identical(getOption("reticulate.python.initializing"), TRUE) &&
358358
identical(config$conda, TRUE)
359-
359+
360360
if (initenv) {
361361
fmt <- "* Found conda installation at %s; creating 'r-reticulate' environment ..."
362362
messagef(fmt, pretty_path(config$prefix))
@@ -389,43 +389,43 @@ py_discover_config <- function(required_module = NULL, use_environment = NULL) {
389389
}
390390

391391
py_discover_config_fallbacks <- function() {
392-
392+
393393
# prefer conda python if available
394394
conda <- find_conda()
395395
if (!is.null(conda) && file.exists(conda)) {
396-
396+
397397
pythons <- tryCatch(
398398
conda_python(envname = "base", conda = conda, all = TRUE),
399399
error = identity
400400
)
401-
401+
402402
if (is.character(pythons))
403403
return(pythons)
404-
404+
405405
}
406-
406+
407407
# on Windows, try looking in the registry
408408
if (is_windows())
409409
return(py_versions_windows()$executable_path)
410-
410+
411411
# otherwise, just search some default locations
412412
prefixes <- c(
413413
"/opt/local/python",
414414
"/opt/python",
415415
"/usr/local",
416416
"/usr"
417417
)
418-
418+
419419
suffixes <- c("bin/python3", "bin/python")
420420
grid <- expand.grid(
421421
prefix = prefixes,
422422
suffix = suffixes,
423423
KEEP.OUT.ATTRS = FALSE,
424424
stringsAsFactors = FALSE
425425
)
426-
426+
427427
paste(grid$prefix, grid$suffix, sep = "/")
428-
428+
429429
}
430430

431431

@@ -1016,7 +1016,7 @@ read_python_versions_from_registry <- function(hive, key,type=key) {
10161016
arch <- NA
10171017
}
10181018
} else { # type == "PythonCore"
1019-
matches <- regexec("^(\\d)\\.(\\d)(?:-(32|64))?$", version)
1019+
matches <- regexec("^(\\d+)\\.(\\d+)(?:-(32|64))?$", version)
10201020
matches <- regmatches(version, matches)[[1]]
10211021
if (length(matches) == 4) {
10221022
version <- paste(matches[[2]], matches[[3]], sep = ".")

0 commit comments

Comments
 (0)